remove interaction with messages

This commit is contained in:
IC Rainbow
2023-12-22 18:19:35 +02:00
parent de697beff1
commit c3cd61aa46
4 changed files with 15 additions and 16 deletions
+1 -1
View File
@@ -831,7 +831,7 @@ data PendingGroupMessage = PendingGroupMessage
type MessageId = Int64
data ConnOrGroupId = ConnectionId Int64 | GroupId Int64 | NoteFolderId Int64
data ConnOrGroupId = ConnectionId Int64 | GroupId Int64
data SndMsgDelivery = SndMsgDelivery
{ connId :: Int64,
@@ -30,7 +30,6 @@ m20231219_note_folders =
);
ALTER TABLE chat_items ADD COLUMN note_folder_id INTEGER DEFAULT NULL REFERENCES note_folders ON DELETE CASCADE;
ALTER TABLE messages ADD COLUMN note_folder_id INTEGER DEFAULT NULL REFERENCES note_folders ON DELETE CASCADE;
ALTER TABLE chat_item_reactions ADD COLUMN note_folder_id INTEGER DEFAULT NULL REFERENCES note_folders ON DELETE CASCADE;
|]
@@ -40,6 +39,5 @@ down_m20231219_note_folders =
DROP INDEX idx_note_folders_user_id_local_display_name;
DROP TABLE note_folders;
ALTER TABLE chat_items DROP COLUMN note_folder_id;
ALTER TABLE messages DROP COLUMN note_folder_id;
ALTER TABLE chat_item_reactions DROP COLUMN note_folder_id;
|]
+6 -8
View File
@@ -170,18 +170,17 @@ createNewSndMessage db gVar connOrGroupId mkMessage =
db
[sql|
INSERT INTO messages (
msg_sent, chat_msg_event, msg_body, connection_id, group_id, note_folder_id,
msg_sent, chat_msg_event, msg_body, connection_id, group_id,
shared_msg_id, shared_msg_id_user, created_at, updated_at
) VALUES (?,?,?,?,?,?,?,?,?,?)
) VALUES (?,?,?,?,?,?,?,?,?)
|]
(MDSnd, toCMEventTag chatMsgEvent, msgBody, connId_, groupId_, folderId_, sharedMsgId, Just True, createdAt, createdAt)
(MDSnd, toCMEventTag chatMsgEvent, msgBody, connId_, groupId_, sharedMsgId, Just True, createdAt, createdAt)
msgId <- insertedRowId db
pure SndMessage {msgId, sharedMsgId = SharedMsgId sharedMsgId, msgBody}
where
(connId_, groupId_, folderId_) = case connOrGroupId of
ConnectionId connId -> (Just connId, Nothing, Nothing)
GroupId groupId -> (Nothing, Just groupId, Nothing)
NoteFolderId folderId -> (Nothing, Nothing, Just folderId)
(connId_, groupId_) = case connOrGroupId of
ConnectionId connId -> (Just connId, Nothing)
GroupId groupId -> (Nothing, Just groupId)
createSndMsgDelivery :: DB.Connection -> SndMsgDelivery -> MessageId -> IO Int64
createSndMsgDelivery db sndMsgDelivery messageId = do
@@ -214,7 +213,6 @@ createNewRcvMessage db connOrGroupId NewMessage {chatMsgEvent, msgBody} sharedMs
throwError $ SEDuplicateGroupMessage groupId sharedMsgId duplAuthorId duplFwdMemberId
Nothing -> liftIO $ insertRcvMsg Nothing $ Just groupId
Nothing -> liftIO $ insertRcvMsg Nothing $ Just groupId
NoteFolderId _folderId -> error "TODO: createNewRcvMessage.NoteFolderId"
where
duplicateGroupMsgMemberIds :: Int64 -> SharedMsgId -> IO (Maybe (Maybe GroupMemberId, Maybe GroupMemberId))
duplicateGroupMsgMemberIds groupId sharedMsgId =