fix url search returning the same post indefinitely (#1695)

This commit is contained in:
Konrad Pozniak 2020-02-17 19:34:11 +01:00 committed by GitHub
parent 222224e78a
commit 6a60a2a6a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -97,12 +97,12 @@ class SearchDataSource<T>(
.subscribe( .subscribe(
{ data -> { data ->
// Working around Mastodon bug where exact match is returned no matter // Working around Mastodon bug where exact match is returned no matter
// which offset is requested (so if we seach for a full username, it's // which offset is requested (so if we search for a full username, it's
// infinite) // infinite)
// see https://github.com/tootsuite/mastodon/issues/11365 // see https://github.com/tootsuite/mastodon/issues/11365
val res = if (data.accounts.size == 1 // see https://github.com/tootsuite/mastodon/issues/13083
&& data.accounts[0].username val res = if ((data.accounts.size == 1 && data.accounts[0].username.equals(searchRequest, ignoreCase = true))
.equals(searchRequest, ignoreCase = true)) { || (data.statuses.size == 1 && data.statuses[0].url.equals(searchRequest))) {
listOf() listOf()
} else { } else {
parser(data) parser(data)