Only search for relationships if there are accounts (#1187)

Otherwise this would lead to a `badRequest`
This commit is contained in:
Nathan Mattes 2023-11-30 15:41:05 +01:00
parent 3ee2024c3b
commit 624c3226d5
1 changed files with 9 additions and 4 deletions

View File

@ -125,10 +125,15 @@ extension SearchResultViewModel.State {
let accounts = searchResults.accounts
let relationships = try await viewModel.context.apiService.relationship(
let relationships: [Mastodon.Entity.Relationship]
if accounts.isNotEmpty {
relationships = try await viewModel.context.apiService.relationship(
forAccounts: accounts,
authenticationBox: viewModel.authContext.mastodonAuthenticationBox
).value
} else {
relationships = []
}
let statusIDs = searchResults.statuses.map { $0.id }