mirror of
https://github.com/aljazceru/ditto.git
synced 2026-02-23 14:06:58 +01:00
Hide non-profile nostr URIs from text
This commit is contained in:
@@ -32,15 +32,23 @@ Deno.test('parseNoteContent parses mentions with apostrophes', () => {
|
||||
);
|
||||
assertEquals(
|
||||
html,
|
||||
`did you see <span class="h-card"><a class="u-url mention" href="https://gleasonator.dev/@alex" rel="ugc">@<span>alex@gleasonator.dev</span></a></span>'s speech?`,
|
||||
'did you see <span class="h-card"><a class="u-url mention" href="https://gleasonator.dev/@alex" rel="ugc">@<span>alex@gleasonator.dev</span></a></span>'s speech?',
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test("parseNoteContent doesn't parse invalid nostr URIs", () => {
|
||||
const { html } = parseNoteContent(`nip19 has URIs like nostr:npub and nostr:nevent, etc.`, []);
|
||||
const { html } = parseNoteContent('nip19 has URIs like nostr:npub and nostr:nevent, etc.', []);
|
||||
assertEquals(html, 'nip19 has URIs like nostr:npub and nostr:nevent, etc.');
|
||||
});
|
||||
|
||||
Deno.test('parseNoteContent renders empty for non-profile nostr URIs', () => {
|
||||
const { html } = parseNoteContent(
|
||||
'nostr:nevent1qgsr9cvzwc652r4m83d86ykplrnm9dg5gwdvzzn8ameanlvut35wy3gpz3mhxue69uhhztnnwashymtnw3ezucm0d5qzqru8mkz2q4gzsxg99q7pdneyx7n8p5u0afe3ntapj4sryxxmg4gpcdvgce',
|
||||
[],
|
||||
);
|
||||
assertEquals(html, '');
|
||||
});
|
||||
|
||||
Deno.test('getMediaLinks', () => {
|
||||
const links = [
|
||||
{ href: 'https://example.com/image.png' },
|
||||
|
||||
Reference in New Issue
Block a user