mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-31 15:25:13 +00:00
core: message reactions (#2429)
* core: message reactions * remove comments * core: commands to set reactions * fix tests * process reaction messages * store functions * include reactions on item updates * remove print * view, tests * load reactions for new items * test removing reaction * remove spaces * limit the number of different reactions on one item * remove unique constraints * fix permissions * indexes * check chat item content before adding reaction * fix group reactions * simpler index --------- Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
baf3a12009
commit
c06a970987
@@ -463,6 +463,20 @@ CREATE TABLE chat_item_versions(
|
||||
created_at TEXT NOT NULL DEFAULT(datetime('now')),
|
||||
updated_at TEXT NOT NULL DEFAULT(datetime('now'))
|
||||
);
|
||||
CREATE TABLE chat_item_reactions(
|
||||
chat_item_reaction_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
item_member_id BLOB, -- member that created item, NULL for items in direct chats
|
||||
shared_msg_id BLOB NOT NULL,
|
||||
contact_id INTEGER REFERENCES contacts ON DELETE CASCADE,
|
||||
group_id INTEGER REFERENCES groups ON DELETE CASCADE,
|
||||
group_member_id INTEGER REFERENCES group_members ON DELETE SET NULL, -- member that sent reaction, NULL for items in direct chats
|
||||
created_by_msg_id INTEGER REFERENCES messages(message_id) ON DELETE SET NULL,
|
||||
reaction TEXT NOT NULL, -- JSON of MsgReaction
|
||||
reaction_sent INTEGER NOT NULL, -- 0 for received, 1 for sent
|
||||
reaction_ts TEXT NOT NULL, -- broker_ts of creating message for received, created_at for sent
|
||||
created_at TEXT NOT NULL DEFAULT(datetime('now')),
|
||||
updated_at TEXT NOT NULL DEFAULT(datetime('now'))
|
||||
);
|
||||
CREATE INDEX contact_profiles_index ON contact_profiles(
|
||||
display_name,
|
||||
full_name
|
||||
@@ -607,3 +621,21 @@ CREATE INDEX idx_xftp_file_descriptions_user_id ON xftp_file_descriptions(
|
||||
CREATE INDEX idx_chat_item_versions_chat_item_id ON chat_item_versions(
|
||||
chat_item_id
|
||||
);
|
||||
CREATE INDEX idx_chat_item_reactions_shared_msg_id ON chat_item_reactions(
|
||||
shared_msg_id
|
||||
);
|
||||
CREATE INDEX idx_chat_item_reactions_contact_id ON chat_item_reactions(
|
||||
contact_id
|
||||
);
|
||||
CREATE INDEX idx_chat_item_reactions_group_id ON chat_item_reactions(group_id);
|
||||
CREATE INDEX idx_chat_item_reactions_group_member_id ON chat_item_reactions(
|
||||
group_member_id
|
||||
);
|
||||
CREATE INDEX idx_chat_item_reactions_contact ON chat_item_reactions(
|
||||
contact_id,
|
||||
shared_msg_id
|
||||
);
|
||||
CREATE INDEX idx_chat_item_reactions_group ON chat_item_reactions(
|
||||
group_id,
|
||||
shared_msg_id
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user