1
0
mirror of https://github.com/NicolasConstant/sengi synced 2024-12-22 13:54:10 +01:00

filter on uri only if multiple results

This commit is contained in:
Nicolas Constant 2024-11-26 21:07:01 -05:00
parent ec27b307d0
commit 565717debc

View File

@ -167,7 +167,12 @@ export class ThreadComponent extends BrowseBase {
return this.mastodonService.search(currentAccount, status.uri, version, true);
})
.then((result: Results) => {
const retrievedStatus = result.statuses.find(({ uri }) => uri === status.uri);
let retrievedStatus: Status = null;
if (result.statuses.length === 1) {
retrievedStatus = result.statuses[0];
} else if(result.statuses.length > 1){
retrievedStatus = result.statuses.find(({ uri }) => uri === status.uri);
}
if (retrievedStatus) {
return retrievedStatus;
}