Merge remote-tracking branch 'origin/main' into nip05-request

This commit is contained in:
Alex Gleason 2024-06-07 11:29:50 -05:00
commit 4d0b869bd7
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
3 changed files with 16 additions and 5 deletions

View File

@ -14,7 +14,7 @@ import { lookupAccount } from '@/utils/lookup.ts';
import { renderAccounts, renderEventAccounts, renderStatuses } from '@/views.ts';
import { accountFromPubkey, renderAccount } from '@/views/mastodon/accounts.ts';
import { renderRelationship } from '@/views/mastodon/relationships.ts';
import { renderStatus } from '@/views/mastodon/statuses.ts';
import { renderReblog, renderStatus } from '@/views/mastodon/statuses.ts';
import { hydrateEvents } from '@/storages/hydrate.ts';
import { bech32ToPubkey } from '@/utils.ts';
import { addTag, deleteTag, findReplyTag, getTagSet } from '@/utils/tags.ts';
@ -192,7 +192,7 @@ const accountStatusesController: AppController = async (c) => {
const filter: NostrFilter = {
authors: [pubkey],
kinds: [1],
kinds: [1, 6],
since,
until,
limit,
@ -206,7 +206,10 @@ const accountStatusesController: AppController = async (c) => {
.then((events) => hydrateEvents({ events, store, signal }))
.then((events) => {
if (exclude_replies) {
return events.filter((event) => !findReplyTag(event.tags));
return events.filter((event) => {
if (event.kind === 1) return !findReplyTag(event.tags);
return true;
});
}
return events;
});
@ -214,7 +217,10 @@ const accountStatusesController: AppController = async (c) => {
const viewerPubkey = await c.get('signer')?.getPublicKey();
const statuses = await Promise.all(
events.map((event) => renderStatus(event, { viewerPubkey })),
events.map((event) => {
if (event.kind === 6) return renderReblog(event, { viewerPubkey });
return renderStatus(event, { viewerPubkey });
}),
);
return paginated(c, events, statuses);
};

View File

@ -104,6 +104,11 @@ const createStatusController: AppController = async (c) => {
tags.push(['subject', data.spoiler_text]);
}
if (data.language) {
tags.push(['L', 'ISO-639-1']);
tags.push(['l', data.language, 'ISO-639-1']);
}
const media = data.media_ids?.length ? await getUnattachedMediaByIds(kysely, data.media_ids) : [];
const imeta: string[][] = media.map(({ data }) => {

View File

@ -100,7 +100,7 @@ async function renderStatus(event: DittoEvent, opts: RenderStatusOpts): Promise<
sensitive: !!cw,
spoiler_text: (cw ? cw[1] : subject?.[1]) || '',
visibility: 'public',
language: event.tags.find((tag) => tag[0] === 'lang')?.[1] || null,
language: event.tags.find((tag) => tag[0] === 'l' && tag[2] === 'ISO-639-1')?.[1] || null,
replies_count: event.event_stats?.replies_count ?? 0,
reblogs_count: event.event_stats?.reposts_count ?? 0,
favourites_count: event.event_stats?.reactions['+'] ?? 0,