mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
refactor: remove nip05 enhancement and tests
This commit is contained in:
parent
6551f0c677
commit
9c02a2d555
2 changed files with 1 additions and 25 deletions
|
|
@ -217,24 +217,3 @@ Deno.test("throws a RelayError when querying an event with a large 'kind'", asyn
|
||||||
'kind filter too far into the future',
|
'kind filter too far into the future',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test(
|
|
||||||
'query user by NIP-05 search filter',
|
|
||||||
{ ignore: Conf.db.dialect !== 'postgres' },
|
|
||||||
async () => {
|
|
||||||
await using db = await createTestDB();
|
|
||||||
const { store } = db;
|
|
||||||
|
|
||||||
const event0 = await eventFixture('event-0');
|
|
||||||
await store.event(event0);
|
|
||||||
|
|
||||||
assertEquals(await store.query([{}]), [event0]);
|
|
||||||
assertEquals(await store.query([{ search: 'sonator.dev' }]), []);
|
|
||||||
assertEquals(await store.query([{ search: 'alex' }]), [event0]);
|
|
||||||
assertEquals(await store.query([{ search: 'gleasonator' }]), [event0]);
|
|
||||||
assertEquals(await store.query([{ search: 'com' }]), [event0]);
|
|
||||||
assertEquals(await store.query([{ search: 'mostr' }]), [event0]);
|
|
||||||
assertEquals(await store.query([{ search: 'pub' }]), [event0]);
|
|
||||||
assertEquals(await store.query([{ search: 'mostr.pub' }]), [event0]);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
|
||||||
|
|
@ -240,10 +240,7 @@ class EventsDB implements NStore {
|
||||||
/** Build search content for a user. */
|
/** Build search content for a user. */
|
||||||
static buildUserSearchContent(event: NostrEvent): string {
|
static buildUserSearchContent(event: NostrEvent): string {
|
||||||
const { name, nip05 } = n.json().pipe(n.metadata()).catch({}).parse(event.content);
|
const { name, nip05 } = n.json().pipe(n.metadata()).catch({}).parse(event.content);
|
||||||
const nip05splitted = nip05 ? nip05.split(/[_@.]/) : [];
|
return [name, nip05].filter(Boolean).join('\n');
|
||||||
const nip05splitted2 = nip05 ? nip05.split(/[@]/) : [];
|
|
||||||
|
|
||||||
return [name, nip05, ...nip05splitted, ...nip05splitted2].filter(Boolean).join('\n');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Build search content from tag values. */
|
/** Build search content from tag values. */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue