diff --git a/src/Simplex/Chat.hs b/src/Simplex/Chat.hs index 69b3d8cbac..7b5fe5f775 100644 --- a/src/Simplex/Chat.hs +++ b/src/Simplex/Chat.hs @@ -987,7 +987,7 @@ processChatCommand = \case when (memberStatus membership == GSMemInvited) $ throwChatError (CEGroupNotJoined gInfo) unless (memberActive membership) $ throwChatError CEGroupMemberNotActive groupLinkId <- GroupLinkId <$> (asks idsDrg >>= liftIO . (`randomBytes` 16)) - let crClientData = encodeJSON $ CRGroupData groupLinkId + let crClientData = encodeJSON $ CRDataGroup groupLinkId (connId, cReq) <- withAgent $ \a -> createConnection a True SCMContact $ Just crClientData withStore $ \db -> createGroupLink db user gInfo connId cReq groupLinkId pure $ CRGroupLinkCreated gInfo cReq @@ -1125,7 +1125,7 @@ processChatCommand = \case incognitoProfile <- if incognito then Just <$> liftIO generateRandomProfile else pure Nothing let profileToSend = fromMaybe profile incognitoProfile connId <- withAgent $ \a -> joinConnection a True cReq $ directMessage (XContact profileToSend $ Just xContactId) - let groupLinkId = crClientData >>= decodeJSON >>= \(CRGroupData gli) -> Just gli + let groupLinkId = crClientData >>= decodeJSON >>= \(CRDataGroup gli) -> Just gli conn <- withStore' $ \db -> createConnReqConnection db userId connId cReqHash xContactId incognitoProfile groupLinkId toView $ CRNewContactConnection conn pure $ CRSentInvitation incognitoProfile diff --git a/src/Simplex/Chat/Types.hs b/src/Simplex/Chat/Types.hs index b68c8a8485..d458e1be6d 100644 --- a/src/Simplex/Chat/Types.hs +++ b/src/Simplex/Chat/Types.hs @@ -571,15 +571,15 @@ instance ToField ImageData where toField (ImageData t) = toField t instance FromField ImageData where fromField = fmap ImageData . fromField -data CReqClientData = CRGroupData {groupLinkId :: GroupLinkId} +data CReqClientData = CRDataGroup {groupLinkId :: GroupLinkId} deriving (Generic) instance ToJSON CReqClientData where - toJSON = J.genericToJSON . taggedObjectJSON $ dropPrefix "CR" - toEncoding = J.genericToEncoding . taggedObjectJSON $ dropPrefix "CR" + toJSON = J.genericToJSON . taggedObjectJSON $ dropPrefix "CRData" + toEncoding = J.genericToEncoding . taggedObjectJSON $ dropPrefix "CRData" instance FromJSON CReqClientData where - parseJSON = J.genericParseJSON . taggedObjectJSON $ dropPrefix "CR" + parseJSON = J.genericParseJSON . taggedObjectJSON $ dropPrefix "CRData" newtype GroupLinkId = GroupLinkId {unGroupLinkId :: ByteString} -- used to identify invitation via group link deriving (Eq, Show)