Fix favourites of kind 20 events

This commit is contained in:
Alex Gleason 2025-01-05 11:37:38 -06:00
parent 079177ea0b
commit b61eb2ff11
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 6 additions and 3 deletions

View file

@ -290,7 +290,7 @@ const deleteStatusController: AppController = async (c) => {
const contextController: AppController = async (c) => {
const id = c.req.param('id');
const store = c.get('store');
const event = await getEvent(id, { kind: 1, relations: ['author', 'event_stats', 'author_stats'] });
const [event] = await store.query([{ kinds: [1, 20], ids: [id] }]);
const viewerPubkey = await c.get('signer')?.getPublicKey();
async function renderStatuses(events: NostrEvent[]) {
@ -325,7 +325,8 @@ const contextController: AppController = async (c) => {
const favouriteController: AppController = async (c) => {
const id = c.req.param('id');
const target = await getEvent(id, { kind: 1, relations: ['author', 'event_stats', 'author_stats'] });
const store = await Storages.db();
const [target] = await store.query([{ ids: [id], kinds: [1, 20] }]);
if (target) {
await createEvent({
@ -337,6 +338,8 @@ const favouriteController: AppController = async (c) => {
],
}, c);
await hydrateEvents({ events: [target], store });
const status = await renderStatus(target, { viewerPubkey: await c.get('signer')?.getPublicKey() });
if (status) {

View file

@ -16,7 +16,7 @@ interface GetEventOpts {
signal?: AbortSignal;
/** Event kind. */
kind?: number;
/** Relations to include on the event. */
/** @deprecated Relations to include on the event. */
relations?: DittoRelation[];
}