mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-06-05 05:53:12 +00:00
core: api to forward messages (#3968)
* wip
* wip
* test
* mute
* tests
* simplify (only bool flag)
* re-encrypt file
* tests
* more tests (wip)
* fix relative paths, refactor
* more tests
* more locks
* fix, tests
* more tests
* rework (revert from bool to ids)
* update schema
* more tests
* add to info
* ForwardedMsg container
* Revert "ForwardedMsg container"
This reverts commit bb57f12151.
* parser
* more tests
* rework api
* more locks
* test
* move
* remove from
* view
* prohibit editing
* item info view
---------
Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
f8e6a78a3b
commit
a5db36469d
@@ -0,0 +1,36 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Migrations.M20240402_item_forwarded where
|
||||
|
||||
import Database.SQLite.Simple (Query)
|
||||
import Database.SQLite.Simple.QQ (sql)
|
||||
|
||||
m20240402_item_forwarded :: Query
|
||||
m20240402_item_forwarded =
|
||||
[sql|
|
||||
ALTER TABLE chat_items ADD COLUMN fwd_from_tag TEXT;
|
||||
ALTER TABLE chat_items ADD COLUMN fwd_from_chat_name TEXT;
|
||||
ALTER TABLE chat_items ADD COLUMN fwd_from_msg_dir INTEGER;
|
||||
ALTER TABLE chat_items ADD COLUMN fwd_from_contact_id INTEGER REFERENCES contacts ON DELETE SET NULL;
|
||||
ALTER TABLE chat_items ADD COLUMN fwd_from_group_id INTEGER REFERENCES groups ON DELETE SET NULL;
|
||||
ALTER TABLE chat_items ADD COLUMN fwd_from_chat_item_id INTEGER REFERENCES chat_items ON DELETE SET NULL;
|
||||
|
||||
CREATE INDEX idx_chat_items_fwd_from_contact_id ON chat_items(fwd_from_contact_id);
|
||||
CREATE INDEX idx_chat_items_fwd_from_group_id ON chat_items(fwd_from_group_id);
|
||||
CREATE INDEX idx_chat_items_fwd_from_chat_item_id ON chat_items(fwd_from_chat_item_id);
|
||||
|]
|
||||
|
||||
down_m20240402_item_forwarded :: Query
|
||||
down_m20240402_item_forwarded =
|
||||
[sql|
|
||||
DROP INDEX idx_chat_items_fwd_from_contact_id;
|
||||
DROP INDEX idx_chat_items_fwd_from_group_id;
|
||||
DROP INDEX idx_chat_items_fwd_from_chat_item_id;
|
||||
|
||||
ALTER TABLE chat_items DROP COLUMN fwd_from_tag;
|
||||
ALTER TABLE chat_items DROP COLUMN fwd_from_chat_name;
|
||||
ALTER TABLE chat_items DROP COLUMN fwd_from_msg_dir;
|
||||
ALTER TABLE chat_items DROP COLUMN fwd_from_contact_id;
|
||||
ALTER TABLE chat_items DROP COLUMN fwd_from_group_id;
|
||||
ALTER TABLE chat_items DROP COLUMN fwd_from_chat_item_id;
|
||||
|]
|
||||
@@ -382,7 +382,13 @@ CREATE TABLE chat_items(
|
||||
item_deleted_ts TEXT,
|
||||
forwarded_by_group_member_id INTEGER REFERENCES group_members ON DELETE SET NULL,
|
||||
item_content_tag TEXT,
|
||||
note_folder_id INTEGER DEFAULT NULL REFERENCES note_folders ON DELETE CASCADE
|
||||
note_folder_id INTEGER DEFAULT NULL REFERENCES note_folders ON DELETE CASCADE,
|
||||
fwd_from_tag TEXT,
|
||||
fwd_from_chat_name TEXT,
|
||||
fwd_from_msg_dir INTEGER,
|
||||
fwd_from_contact_id INTEGER REFERENCES contacts ON DELETE SET NULL,
|
||||
fwd_from_group_id INTEGER REFERENCES groups ON DELETE SET NULL,
|
||||
fwd_from_chat_item_id INTEGER REFERENCES chat_items ON DELETE SET NULL
|
||||
);
|
||||
CREATE TABLE chat_item_messages(
|
||||
chat_item_id INTEGER NOT NULL REFERENCES chat_items ON DELETE CASCADE,
|
||||
@@ -860,3 +866,10 @@ CREATE INDEX idx_chat_items_notes_item_status on chat_items(
|
||||
item_status
|
||||
);
|
||||
CREATE INDEX idx_files_redirect_file_id on files(redirect_file_id);
|
||||
CREATE INDEX idx_chat_items_fwd_from_contact_id ON chat_items(
|
||||
fwd_from_contact_id
|
||||
);
|
||||
CREATE INDEX idx_chat_items_fwd_from_group_id ON chat_items(fwd_from_group_id);
|
||||
CREATE INDEX idx_chat_items_fwd_from_chat_item_id ON chat_items(
|
||||
fwd_from_chat_item_id
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user