mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-05-10 19:16:57 +00:00
set invitation as not accepted in case of join error (#505)
* set invitation as not accepted in case of join error * remove unused name
This commit is contained in:
committed by
GitHub
parent
a7b39b710c
commit
1459a0613a
@@ -391,7 +391,9 @@ acceptContact' c connId enableNtfs invId ownConnInfo = do
|
||||
withStore c (`getConn` contactConnId) >>= \case
|
||||
SomeConn _ ContactConnection {} -> do
|
||||
withStore' c $ \db -> acceptInvitation db invId ownConnInfo
|
||||
joinConn c connId enableNtfs connReq ownConnInfo
|
||||
joinConn c connId enableNtfs connReq ownConnInfo `catchError` \err -> do
|
||||
withStore' c (`unacceptInvitation` invId)
|
||||
throwError err
|
||||
_ -> throwError $ CMD PROHIBITED
|
||||
|
||||
-- | Reject contact (RJCT command) in Reader monad
|
||||
|
||||
@@ -47,6 +47,7 @@ module Simplex.Messaging.Agent.Store.SQLite
|
||||
createInvitation,
|
||||
getInvitation,
|
||||
acceptInvitation,
|
||||
unacceptInvitation,
|
||||
deleteInvitation,
|
||||
-- Messages
|
||||
updateRcvIds,
|
||||
@@ -504,6 +505,10 @@ acceptInvitation db invitationId ownConnInfo =
|
||||
":invitation_id" := invitationId
|
||||
]
|
||||
|
||||
unacceptInvitation :: DB.Connection -> InvitationId -> IO ()
|
||||
unacceptInvitation db invitationId =
|
||||
DB.execute db "UPDATE conn_invitations SET accepted = 0, own_conn_info = NULL WHERE invitation_id = ?" (Only invitationId)
|
||||
|
||||
deleteInvitation :: DB.Connection -> ConnId -> InvitationId -> IO (Either StoreError ())
|
||||
deleteInvitation db contactConnId invId =
|
||||
getConn db contactConnId $>>= \case
|
||||
|
||||
Reference in New Issue
Block a user