Filter #fedilove on federated timeline and direct messages
to-do: think about leaving this client side? Is there a way to filter federated toots on Mastodon by searching a name containing X string?
This commit is contained in:
parent
3d0eaaea66
commit
f4677e45f4
|
@ -90,5 +90,20 @@ export async function getTimeline (instanceName, accessToken, timeline, maxId, s
|
||||||
if (timeline === 'direct') {
|
if (timeline === 'direct') {
|
||||||
items = items.map(item => item.last_status)
|
items = items.map(item => item.last_status)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (timeline === 'direct' || timeline === 'federated') {
|
||||||
|
let newItems = [];
|
||||||
|
for (var item of items) {
|
||||||
|
if (item.account === undefined)
|
||||||
|
continue;
|
||||||
|
if (item.account.display_name.toLowerCase().includes('#fedilove')) {
|
||||||
|
item.account.display_name =
|
||||||
|
item.account.display_name.replace(/#fedilove/gi, '').trim();
|
||||||
|
newItems.push(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
items = newItems;
|
||||||
|
}
|
||||||
|
|
||||||
return { items, headers }
|
return { items, headers }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue