Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: api to differentiate contacts and conversations #4111

Merged
merged 19 commits into from May 13, 2024

Conversation

spaced4ndy
Copy link
Contributor

No description provided.

src/Simplex/Chat.hs Outdated Show resolved Hide resolved
@spaced4ndy spaced4ndy marked this pull request as ready for review April 30, 2024 11:08
src/Simplex/Chat.hs Outdated Show resolved Hide resolved
src/Simplex/Chat.hs Outdated Show resolved Hide resolved
@@ -1009,22 +1009,41 @@ processChatCommand' vr = \case
liftIO $ updateNoteFolderUnreadChat db user nf unreadChat
ok user
_ -> pure $ chatCmdError (Just user) "not supported"
APIDeleteChat (ChatRef cType chatId) notify -> withUser $ \user@User {userId} -> case cType of
APIDeleteChat cRef@(ChatRef cType chatId) chatDeleteMode -> withUser $ \user@User {userId} -> case cType of
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for CDMEntity and CDMMessages UI would differentiate on response based on call params - update in model instead of deleting

@@ -315,7 +315,7 @@ updateChatTs db User {userId} chatDirection chatTs = case toChatInfo chatDirecti
DirectChat Contact {contactId} ->
DB.execute
db
"UPDATE contacts SET chat_ts = ? WHERE user_id = ? AND contact_id = ?"
"UPDATE contacts SET chat_ts = ?, chat_deleted = 0 WHERE user_id = ? AND contact_id = ?"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on new chat items UI would "manually" update contacts with chatDeleted set to False. May be a bit hacky but it seems a normal assumption to do from UI view point and less hassle than correctly propagate contact update from db operations to all responses in backend. This is somewhat similar in logic to chat "popping" to top on new chat items being only UI logic

@spaced4ndy spaced4ndy merged commit f40ba6f into master May 13, 2024
8 checks passed
@spaced4ndy spaced4ndy deleted the f/contacts-conversations branch May 13, 2024 12:51
@github-actions github-actions bot locked and limited conversation to collaborators May 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants