mirror of
https://github.com/NicolasConstant/sengi
synced 2025-01-18 19:59:44 +01:00
more resilient status search
This commit is contained in:
parent
f3f63f569a
commit
58c1f04609
@ -224,12 +224,17 @@ export class ToolsService {
|
||||
if (!isProvider) {
|
||||
statusPromise = statusPromise
|
||||
.then((foreignStatus: Status) => {
|
||||
const statusUri = foreignStatus.uri;
|
||||
const statusUrl = foreignStatus.url;
|
||||
return this.getInstanceInfo(account)
|
||||
.then(instance => {
|
||||
let version: 'v1' | 'v2' = 'v1';
|
||||
if (instance.major >= 3) version = 'v2';
|
||||
return this.mastodonService.search(account, statusUri, version, true)
|
||||
.then((results: Results) => {
|
||||
if(results && results.statuses.length > 0) return results;
|
||||
return this.mastodonService.search(account, statusUrl, version, true);
|
||||
});
|
||||
})
|
||||
.then((results: Results) => {
|
||||
return results.statuses[0];
|
||||
|
Loading…
Reference in New Issue
Block a user