fix: reblogged field boolean value takes into account viewerPubkey
This commit is contained in:
parent
ae5fe1e0ac
commit
e2b377d9c7
|
@ -245,7 +245,7 @@ const reblogStatusController: AppController = async (c) => {
|
|||
signal: signal,
|
||||
});
|
||||
|
||||
const status = await renderReblog(reblogEvent);
|
||||
const status = await renderReblog(reblogEvent, { viewerPubkey: c.get('pubkey') });
|
||||
|
||||
return c.json(status);
|
||||
};
|
||||
|
|
|
@ -73,7 +73,7 @@ const streamingController: AppController = (c) => {
|
|||
signal: AbortSignal.timeout(1000),
|
||||
});
|
||||
|
||||
const status = await renderReblog(event);
|
||||
const status = await renderReblog(event, { viewerPubkey: c.get('pubkey') });
|
||||
if (status) {
|
||||
send('update', status);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ async function renderStatuses(c: AppContext, filters: NostrFilter[]) {
|
|||
|
||||
const statuses = (await Promise.all(events.map((event) => {
|
||||
if (event.kind === 6) {
|
||||
return renderReblog(event);
|
||||
return renderReblog(event, { viewerPubkey: c.get('pubkey') });
|
||||
}
|
||||
return renderStatus(event, { viewerPubkey: c.get('pubkey') });
|
||||
}))).filter((boolean) => boolean);
|
||||
|
|
|
@ -111,7 +111,9 @@ async function renderStatus(event: DittoEvent, opts: statusOpts): Promise<any> {
|
|||
};
|
||||
}
|
||||
|
||||
async function renderReblog(event: DittoEvent) {
|
||||
async function renderReblog(event: DittoEvent, opts: statusOpts) {
|
||||
const { viewerPubkey } = opts;
|
||||
|
||||
if (!event.author) return;
|
||||
|
||||
const repostId = event.tags.find(([name]) => name === 'e')?.[1];
|
||||
|
@ -119,8 +121,7 @@ async function renderReblog(event: DittoEvent) {
|
|||
|
||||
if (!event.repost) return;
|
||||
|
||||
const reblog = await renderStatus(event.repost, {});
|
||||
reblog.reblogged = true;
|
||||
const reblog = await renderStatus(event.repost, { viewerPubkey });
|
||||
|
||||
return {
|
||||
id: event.id,
|
||||
|
|
Loading…
Reference in New Issue