update entity connection status to report it correctly (#257)
This commit is contained in:
parent
38424af48e
commit
dafdf66ada
@ -505,7 +505,7 @@ processAgentMessage user@User {userId, profile} agentConnId agentMessage =
|
||||
Just connStatus -> do
|
||||
let conn = (entityConnection acEntity) {connStatus}
|
||||
withStore $ \st -> updateConnectionStatus st conn connStatus
|
||||
pure acEntity {entityConnection = conn}
|
||||
pure $ updateEntityConnStatus acEntity connStatus
|
||||
Nothing -> pure acEntity
|
||||
|
||||
isMember :: MemberId -> GroupInfo -> [GroupMember] -> Bool
|
||||
|
@ -38,6 +38,16 @@ data ConnectionEntity
|
||||
| UserContactConnection {entityConnection :: Connection, userContact :: UserContact}
|
||||
deriving (Eq, Show)
|
||||
|
||||
updateEntityConnStatus :: ConnectionEntity -> ConnStatus -> ConnectionEntity
|
||||
updateEntityConnStatus connEntity connStatus = case connEntity of
|
||||
RcvDirectMsgConnection c ct_ -> RcvDirectMsgConnection (st c) ((\ct -> (ct :: Contact) {activeConn = st c}) <$> ct_)
|
||||
RcvGroupMsgConnection c gInfo m@GroupMember {activeConn = c'} -> RcvGroupMsgConnection (st c) gInfo m {activeConn = st <$> c'}
|
||||
SndFileConnection c ft -> SndFileConnection (st c) ft
|
||||
RcvFileConnection c ft -> RcvFileConnection (st c) ft
|
||||
UserContactConnection c uc -> UserContactConnection (st c) uc
|
||||
where
|
||||
st c = c {connStatus}
|
||||
|
||||
-- chat message is sent as JSON with these properties
|
||||
data AppMessage = AppMessage
|
||||
{ event :: Text,
|
||||
|
Loading…
Reference in New Issue
Block a user