feat(chat): delete a chat, disband a group, Seen — and purge what everyone deleted
Delete chat is the caller's alone: the history so far vanishes for them (chat_members.cleared_id) and a direct chat leaves their list (hidden) until a new message arrives; the others keep theirs. What EVERY member has deleted is deleted for real (purge): messages up to the lowest cleared_id and their files on disk, and a direct chat both people deleted, whole. Purge also runs when a member leaves or is removed. A group's creator disbands it for everyone (DELETE /api/chat/rooms/:id). Seen: rooms carry every member's read mark (reads); a mark that moves is told to the members (chat_read, exactAudience) and never passes the newest message. Under your newest message: Seen / Seen by … / Seen by everyone. A room open on a tab you come back to is marked read then.
This commit is contained in:
@@ -1952,6 +1952,15 @@ db.exec(`
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_chat_files_message ON chat_files(message_id);
|
||||
`);
|
||||
// A member's own "delete this chat": messages up to cleared_id are gone for
|
||||
// them (not for anyone else), and a hidden direct chat leaves their list until
|
||||
// a new message arrives. Additive.
|
||||
try {
|
||||
db.prepare("SELECT cleared_id, hidden FROM chat_members LIMIT 1").get();
|
||||
} catch {
|
||||
db.prepare("ALTER TABLE chat_members ADD COLUMN cleared_id INTEGER NOT NULL DEFAULT 0").run();
|
||||
db.prepare("ALTER TABLE chat_members ADD COLUMN hidden INTEGER NOT NULL DEFAULT 0").run();
|
||||
}
|
||||
|
||||
// An account's own agent instructions, put before every workspace's in each
|
||||
// pane it owns (server/lib/lane-sources.js, issue #67). Additive.
|
||||
|
||||
Reference in New Issue
Block a user