fix(streaming): don't show posts from blocked users

This commit is contained in:
P. Reis 2024-04-30 21:23:25 -03:00
parent e8e45360d3
commit f0c66c1e92
1 changed files with 10 additions and 4 deletions

View File

@ -8,8 +8,9 @@ import { getFeedPubkeys } from '@/queries.ts';
import { bech32ToPubkey } from '@/utils.ts';
import { renderReblog, renderStatus } from '@/views/mastodon/statuses.ts';
import { hydrateEvents } from '@/storages/hydrate.ts';
import { eventsDB } from '@/storages.ts';
import { Storages } from '@/storages.ts';
import { UserStore } from '@/storages/UserStore.ts';
import { getAdminStore } from '@/storages/adminStore.ts';
const debug = Debug('ditto:streaming');
@ -71,9 +72,14 @@ const streamingController: AppController = (c) => {
try {
for await (const msg of Storages.pubsub.req([filter], { signal: controller.signal })) {
if (msg[0] === 'EVENT') {
const [event] = await hydrateEvents({
events: [msg[2]],
storage: eventsDB,
const store = new UserStore(pubkey as string, getAdminStore());
const [event] = await store.query([{ ids: [msg[2].id] }]);
if (!event) continue;
await hydrateEvents({
events: [event],
storage: store,
signal: AbortSignal.timeout(1000),
});