mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-06-05 03:41:54 +00:00
core: rfc, protocol and types for user reports (#5451)
* core: rfc, protocol and types for user reports * add comment * rfc * moderation rfc * api, types * update * typos * migration * update * report reason * query * deleted * remove auto-accepting conditions for SimpleX Chat Ltd * api, query * make indices work * index without filtering * query for unread * postgres: rework chat list pagination query (#5441) * fix query * fix * report counts to stats * internalMark * fix parser * AND * delete reports on event, fix counters * test * remove reports when message is moderated on sending side --------- Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Migrations.M20241230_reports where
|
||||
module Simplex.Chat.Migrations.M20241230_reports where
|
||||
|
||||
import Database.SQLite.Simple (Query)
|
||||
import Database.SQLite.Simple.QQ (sql)
|
||||
import Database.SQLite.Simple (Query)
|
||||
import Database.SQLite.Simple.QQ (sql)
|
||||
|
||||
m20241230_reports :: Query
|
||||
m20241230_reports =
|
||||
[sql|
|
||||
m20241230_reports :: Query
|
||||
m20241230_reports =
|
||||
[sql|
|
||||
ALTER TABLE chat_items ADD COLUMN msg_content_tag TEXT;
|
||||
|]
|
||||
|
||||
down_m20241230_reports :: Query
|
||||
down_m20241230_reports =
|
||||
[sql|
|
||||
down_m20241230_reports :: Query
|
||||
down_m20241230_reports =
|
||||
[sql|
|
||||
ALTER TABLE chat_items DROP COLUMN msg_content_tag;
|
||||
|]
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Migrations.M20250105_indexes where
|
||||
|
||||
import Database.SQLite.Simple (Query)
|
||||
import Database.SQLite.Simple.QQ (sql)
|
||||
|
||||
m20250105_indexes :: Query
|
||||
m20250105_indexes =
|
||||
[sql|
|
||||
CREATE INDEX idx_chat_items_groups_msg_content_tag_item_ts ON chat_items(user_id, group_id, msg_content_tag, item_ts);
|
||||
CREATE INDEX idx_chat_items_groups_msg_content_tag_item_deleted_item_ts ON chat_items(user_id, group_id, msg_content_tag, item_deleted, item_ts);
|
||||
|]
|
||||
|
||||
down_m20250105_indexes :: Query
|
||||
down_m20250105_indexes =
|
||||
[sql|
|
||||
DROP INDEX idx_chat_items_groups_msg_content_tag_item_ts;
|
||||
DROP INDEX idx_chat_items_groups_msg_content_tag_item_deleted_item_ts;
|
||||
|]
|
||||
@@ -962,3 +962,16 @@ CREATE UNIQUE INDEX idx_chat_tags_chats_chat_tag_id_group_id ON chat_tags_chats(
|
||||
group_id,
|
||||
chat_tag_id
|
||||
);
|
||||
CREATE INDEX idx_chat_items_groups_msg_content_tag_item_ts ON chat_items(
|
||||
user_id,
|
||||
group_id,
|
||||
msg_content_tag,
|
||||
item_ts
|
||||
);
|
||||
CREATE INDEX idx_chat_items_groups_msg_content_tag_item_deleted_item_ts ON chat_items(
|
||||
user_id,
|
||||
group_id,
|
||||
msg_content_tag,
|
||||
item_deleted,
|
||||
item_ts
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user