Merge branch 'mention-npub-fix' into 'main'

Only parse mentions with valid pubkeys

See merge request soapbox-pub/ditto!633
This commit is contained in:
Alex Gleason 2025-02-03 20:54:34 +00:00
commit 92f138b3b1

View file

@ -7,7 +7,7 @@ import { MastodonMention } from '@/entities/MastodonMention.ts';
import { MastodonStatus } from '@/entities/MastodonStatus.ts';
import { type DittoEvent } from '@/interfaces/DittoEvent.ts';
import { Storages } from '@/storages.ts';
import { nostrDate } from '@/utils.ts';
import { isNostrId, nostrDate } from '@/utils.ts';
import { getMediaLinks, parseNoteContent, stripimeta } from '@/utils/note.ts';
import { findReplyTag } from '@/utils/tags.ts';
import { unfurlCardCached } from '@/utils/unfurl.ts';
@ -41,8 +41,8 @@ async function renderStatus(event: DittoEvent, opts: RenderStatusOpts): Promise<
const mentionedPubkeys = [
...new Set(
event.tags
.filter((tag) => tag[0] === 'p')
.map((tag) => tag[1]),
.filter(([name, value]) => name === 'p' && isNostrId(value))
.map(([, value]) => value),
),
];