mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
Merge branch 'divine-support' into 'main'
Divine support See merge request soapbox-pub/ditto!738
This commit is contained in:
commit
41bc22a226
2 changed files with 13 additions and 3 deletions
|
|
@ -18,6 +18,7 @@ const searchQuerySchema = z.object({
|
|||
following: z.boolean().default(false),
|
||||
account_id: n.id().optional(),
|
||||
offset: z.coerce.number().nonnegative().catch(0),
|
||||
short_videos_only: z.coerce.boolean().default(false),
|
||||
});
|
||||
|
||||
type SearchQuery = z.infer<typeof searchQuerySchema> & { since?: number; until?: number; limit: number };
|
||||
|
|
@ -66,7 +67,14 @@ const searchController: AppController = async (c) => {
|
|||
),
|
||||
Promise.all(
|
||||
events
|
||||
.filter((event) => event.kind === 1)
|
||||
.filter((event) => {
|
||||
// If short_videos_only is true, only return kinds 22 and 34236
|
||||
if (result.data.short_videos_only) {
|
||||
return [22, 34236].includes(event.kind);
|
||||
}
|
||||
// Otherwise return all status kinds
|
||||
return [1, 21, 22, 34235, 34236].includes(event.kind);
|
||||
})
|
||||
.map((event) => renderStatus(relay, event, { viewerPubkey }))
|
||||
.filter(Boolean),
|
||||
),
|
||||
|
|
@ -141,9 +149,9 @@ function typeToKinds(type: SearchQuery['type']): number[] {
|
|||
case 'accounts':
|
||||
return [0];
|
||||
case 'statuses':
|
||||
return [1];
|
||||
return [1, 21, 22, 34235, 34236];
|
||||
default:
|
||||
return [0, 1];
|
||||
return [0, 1, 21, 22, 34235, 34236];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -490,6 +490,8 @@ export class DittoPgStore extends NPostgres {
|
|||
ext.reply = event.tags.some(([name]) => ['e', 'E'].includes(name)).toString();
|
||||
} else if (event.kind === 6) {
|
||||
ext.reply = 'false';
|
||||
} else if ([21, 22, 34235, 34236].includes(event.kind)) {
|
||||
ext.reply = 'false' // reply must be handled in another way: https://github.com/nostr-protocol/nips/issues/2146
|
||||
}
|
||||
|
||||
if ([1, 20, 30023].includes(event.kind)) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue