2
2
mirror of https://github.com/mastodon/mastodon-ios synced 2025-04-11 22:58:02 +02:00

Don't prioritize hashtags or users (IOS-141)

This commit is contained in:
Nathan Mattes 2023-09-18 17:32:01 +02:00
parent dd569fe0ac
commit 3ce8e29244

View File

@ -37,21 +37,18 @@ extension SearchHistoryViewModel {
do {
let managedObjectContext = self.context.managedObjectContext
let items: [SearchHistoryItem] = try await managedObjectContext.perform {
var users: [SearchHistoryItem] = []
var hashtags: [SearchHistoryItem] = []
var items: [SearchHistoryItem] = []
for record in records {
guard let searchHistory = record.object(in: managedObjectContext) else { continue }
if let user = searchHistory.account {
users.append(.user(.init(objectID: user.objectID)))
items.append(.user(.init(objectID: user.objectID)))
} else if let hashtag = searchHistory.hashtag {
hashtags.append(.hashtag(.init(objectID: hashtag.objectID)))
} else {
continue
items.append(.hashtag(.init(objectID: hashtag.objectID)))
}
}
return users + hashtags
return items
}
let mostRecentItems = Array(items.prefix(10))