Fix missing context menu actions on follow notifications for only one person

This commit is contained in:
Shadowfacts 2020-01-25 10:29:38 -05:00
parent d6ae51c02f
commit 5a6c12c5a7
1 changed files with 6 additions and 2 deletions

View File

@ -142,15 +142,19 @@ extension FollowNotificationGroupTableViewCell: MenuPreviewProvider {
func getPreviewProviders(for location: CGPoint, sourceViewController: UIViewController) -> PreviewProviders? {
guard let mastodonController = mastodonController else { return nil }
let accountIDs = self.group.notificationIDs.compactMap(mastodonController.cache.notification(for:)).map { $0.account.id }
return (content: {
let accountIDs = self.group.notificationIDs.compactMap(mastodonController.cache.notification(for:)).map { $0.account.id }
if accountIDs.count == 1 {
return ProfileTableViewController(accountID: accountIDs.first!, mastodonController: mastodonController)
} else {
return AccountListTableViewController(accountIDs: accountIDs, mastodonController: mastodonController)
}
}, actions: {
return []
if accountIDs.count == 1 {
return self.actionsForProfile(accountID: accountIDs.first!, sourceView: self)
} else {
return []
}
})
}
}