fix: search box
This commit is contained in:
@ -132,10 +132,11 @@ export class SqliteRelay extends EventEmitter<RelayHandlerEvents> implements Rel
|
||||
|
||||
// Handle legacy and standard replaceable events (kinds 0, 3, 41, 10000-19999)
|
||||
if (legacyReplaceableKinds.includes(ev.kind) || (ev.kind >= 10_000 && ev.kind < 20_000)) {
|
||||
const oldEvents = db.selectValues(
|
||||
`SELECT id FROM events WHERE kind = ? AND pubkey = ? AND created <= ?`,
|
||||
[ev.kind, ev.pubkey, ev.created_at]
|
||||
) as Array<string>;
|
||||
const oldEvents = db.selectValues(`SELECT id FROM events WHERE kind = ? AND pubkey = ? AND created <= ?`, [
|
||||
ev.kind,
|
||||
ev.pubkey,
|
||||
ev.created_at,
|
||||
]) as Array<string>;
|
||||
|
||||
if (oldEvents.includes(ev.id)) {
|
||||
// Already have this event
|
||||
@ -156,7 +157,7 @@ export class SqliteRelay extends EventEmitter<RelayHandlerEvents> implements Rel
|
||||
FROM events e
|
||||
JOIN tags t ON e.id = t.event_id
|
||||
WHERE e.kind = ? AND e.pubkey = ? AND t.key = ? AND t.value = ? AND created <= ?`,
|
||||
[ev.kind, ev.pubkey, "d", dTag, ev.created_at]
|
||||
[ev.kind, ev.pubkey, "d", dTag, ev.created_at],
|
||||
) as Array<string>;
|
||||
|
||||
if (oldEvents.includes(ev.id)) {
|
||||
@ -177,15 +178,8 @@ export class SqliteRelay extends EventEmitter<RelayHandlerEvents> implements Rel
|
||||
`INSERT OR IGNORE INTO events(id, pubkey, created, kind, json, relays)
|
||||
VALUES(?,?,?,?,?,?)`,
|
||||
{
|
||||
bind: [
|
||||
ev.id,
|
||||
ev.pubkey,
|
||||
ev.created_at,
|
||||
ev.kind,
|
||||
JSON.stringify(evInsert),
|
||||
(ev.relays ?? []).join(","),
|
||||
],
|
||||
}
|
||||
bind: [ev.id, ev.pubkey, ev.created_at, ev.kind, JSON.stringify(evInsert), (ev.relays ?? []).join(",")],
|
||||
},
|
||||
);
|
||||
|
||||
const insertedEvents = db.changes();
|
||||
|
Reference in New Issue
Block a user