BottomSheetActivity: fix account URL search leading to wrong accounts or threads

This commit is contained in:
Alibek Omarov 2020-10-05 20:43:04 +03:00
parent 51083556f1
commit c4931bcc6e
1 changed files with 16 additions and 3 deletions

View File

@ -83,12 +83,25 @@ abstract class BottomSheetActivity : BaseActivity() {
onEndSearch(url)
if (accounts.isNotEmpty()) {
// HACKHACK: Pleroma, remove when search will work normally
if (accounts[0].pleroma != null) {
val account = accounts.firstOrNull { it.pleroma?.apId == url || it.url == url }
if (account != null) {
viewAccount(account.id)
return@subscribe
}
} else {
viewAccount(accounts[0].id)
return@subscribe
}
}
if (statuses.isNotEmpty()) {
viewThread(statuses[0].id, statuses[0].url)
return@subscribe
} else if (accounts.isNotEmpty()) {
viewAccount(accounts[0].id)
return@subscribe
}
performUrlFallbackAction(url, lookupFallbackBehavior)