Merge branch 'fix-blocked-users-in-streaming' into 'main'

Streaming API - Posts from blocked users does not show up in Global tab

Closes #109

See merge request soapbox-pub/ditto!250
This commit is contained in:
Alex Gleason 2024-05-15 00:58:56 +00:00
commit 91a7ebc634
1 changed files with 9 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import { bech32ToPubkey } from '@/utils.ts';
import { renderReblog, renderStatus } from '@/views/mastodon/statuses.ts';
import { hydrateEvents } from '@/storages/hydrate.ts';
import { Storages } from '@/storages.ts';
import { MuteListPolicy } from '@/policies/MuteListPolicy.ts';
const debug = Debug('ditto:streaming');
@ -75,6 +76,14 @@ const streamingController: AppController = (c) => {
if (msg[0] === 'EVENT') {
const event = msg[2];
if (pubkey) {
const policy = new MuteListPolicy(pubkey, await Storages.admin());
const ok = await policy.call(event);
if (ok[2] === false) {
continue;
}
}
await hydrateEvents({
events: [event],
store: optimizer,