refactor: rename listed → discoverable on note

Pure rename — no behavioral change. "discoverable" more clearly
communicates that the field controls whether a note can be found
by others in public listings.
This commit is contained in:
Julien Calixte
2026-02-25 23:20:37 +01:00
parent f39f62f1c7
commit 29e8a63cb3
4 changed files with 17 additions and 11 deletions

View File

@@ -22,10 +22,10 @@ type NoteRow = {
export const getNotes = (cursor?: string, limit = 20) => {
const notes = cursor
? db.prepare(
"SELECT did, rkey, title, publishedAt, createdAt FROM note WHERE listed = 1 AND rkey < ? ORDER BY rkey DESC LIMIT ?",
"SELECT did, rkey, title, publishedAt, createdAt FROM note WHERE discoverable = 1 AND rkey < ? ORDER BY rkey DESC LIMIT ?",
).all<NoteRow>(cursor, limit)
: db.prepare(
"SELECT did, rkey, title, publishedAt, createdAt FROM note WHERE listed = 1 ORDER BY rkey DESC LIMIT ?",
"SELECT did, rkey, title, publishedAt, createdAt FROM note WHERE discoverable = 1 ORDER BY rkey DESC LIMIT ?",
).all<NoteRow>(limit);
return {
@@ -37,10 +37,10 @@ export const getNotes = (cursor?: string, limit = 20) => {
export const getNotesByDid = (did: string, cursor?: string, limit = 20) => {
const notes = cursor
? db.prepare(
"SELECT did, rkey, title, publishedAt, createdAt FROM note WHERE listed = 1 AND did = ? AND rkey < ? ORDER BY rkey DESC LIMIT ?",
"SELECT did, rkey, title, publishedAt, createdAt FROM note WHERE discoverable = 1 AND did = ? AND rkey < ? ORDER BY rkey DESC LIMIT ?",
).all<NoteRow>(did, cursor, limit)
: db.prepare(
"SELECT did, rkey, title, publishedAt, createdAt FROM note WHERE listed = 1 AND did = ? ORDER BY rkey DESC LIMIT ?",
"SELECT did, rkey, title, publishedAt, createdAt FROM note WHERE discoverable = 1 AND did = ? ORDER BY rkey DESC LIMIT ?",
).all<NoteRow>(did, limit);
return {
@@ -108,20 +108,20 @@ export const upsertNote = (note: Note) => {
createdAt,
did,
rkey,
listed
discoverable
)
VALUES (?, ?, ?, ?, ?, ?)
ON CONFLICT(did, rkey)
DO UPDATE SET
title = excluded.title,
publishedAt = excluded.publishedAt,
listed = excluded.listed
discoverable = excluded.discoverable
`,
note.title,
note.publishedAt ? new Date(note.publishedAt).toISOString() : now,
note.createdAt ? new Date(note.createdAt).toISOString() : now,
note.did,
note.rkey,
note.listed !== false ? 1 : 0,
note.discoverable !== false ? 1 : 0,
);
};