mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Fix favourites of kind 20 events
This commit is contained in:
parent
079177ea0b
commit
b61eb2ff11
2 changed files with 6 additions and 3 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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[];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue