core: member mentions, types and rfc (#5555)

* core: member mentions, types and rfc

* update

* update rfc

* save/get mentions (WIP)

* markdown

* store received mentions and userMention flag

* sent mentions

* update message with mentions

* db queries

* CLI mentions, test passes

* use maps for mentions

* tests

* comment

* save mentions on sent messages

* postresql schema

* refactor

* M.empty

* include both displayName and localAlias into MentionedMemberInfo

* fix saving sent mentions

* include mentions in previews

* update plans
This commit is contained in:
Evgeny
2025-01-29 13:04:48 +00:00
committed by GitHub
parent c20e94f2fb
commit 621b291da1
31 changed files with 858 additions and 316 deletions
@@ -426,7 +426,8 @@ CREATE TABLE chat_items(
fwd_from_chat_item_id BIGINT REFERENCES chat_items ON DELETE SET NULL,
via_proxy SMALLINT,
msg_content_tag TEXT,
include_in_history SMALLINT NOT NULL DEFAULT 0
include_in_history SMALLINT NOT NULL DEFAULT 0,
user_mention SMALLINT NOT NULL DEFAULT 0
);
ALTER TABLE groups
ADD CONSTRAINT fk_groups_chat_items
@@ -676,6 +677,13 @@ CREATE TABLE chat_tags_chats(
group_id BIGINT REFERENCES groups ON DELETE CASCADE,
chat_tag_id BIGINT NOT NULL REFERENCES chat_tags ON DELETE CASCADE
);
CREATE TABLE chat_item_mentions (
chat_item_mention_id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
chat_item_id BIGINT NOT NULL REFERENCES chat_items ON DELETE CASCADE,
group_id BIGINT NOT NULL REFERENCES groups ON DELETE CASCADE,
member_id BYTEA NOT NULL,
display_name TEXT NOT NULL
);
CREATE INDEX contact_profiles_index ON contact_profiles(
display_name,
full_name
@@ -1025,4 +1033,8 @@ CREATE INDEX idx_group_snd_item_statuses_chat_item_id_group_member_id ON group_s
chat_item_id,
group_member_id
);
CREATE INDEX idx_chat_item_mentions_group_id ON chat_item_mentions(group_id);
CREATE INDEX idx_chat_item_mentions_chat_item_id ON chat_item_mentions(chat_item_id);
CREATE UNIQUE INDEX idx_chat_item_mentions_display_name ON chat_item_mentions(chat_item_id, display_name);
CREATE UNIQUE INDEX idx_chat_item_mentions_member_id ON chat_item_mentions(chat_item_id, member_id);
|]