diff --git a/src/Simplex/Chat/Store/Shared.hs b/src/Simplex/Chat/Store/Shared.hs index d420369b00..c7031528ac 100644 --- a/src/Simplex/Chat/Store/Shared.hs +++ b/src/Simplex/Chat/Store/Shared.hs @@ -676,7 +676,8 @@ toGroupInfo vr userContactId chatTags ((groupId, localDisplayName, displayName, let membership = (toGroupMember userContactId userMemberRow) {memberChatVRange = vr} chatSettings = ChatSettings {enableNtfs = fromMaybe MFAll enableNtfs_, sendRcpts = unBI <$> sendRcpts, favorite} fullGroupPreferences = mergeGroupPreferences groupPreferences - (sharedGroupId, groupKeys) = toGroupKeys groupKeysRow + groupKeys = toGroupKeys groupKeysRow + sharedGroupId = (\GroupKeys {sharedGroupId = gId} -> gId) <$> groupKeys groupProfile = GroupProfile {displayName, fullName, shortDescr, description, image, groupPreferences, memberAdmission, groupLink, sharedGroupId} businessChat = toBusinessChatInfo businessRow preparedGroup = toPreparedGroup preparedGroupRow @@ -689,14 +690,12 @@ toPreparedGroup = \case Just PreparedGroup {connLinkToConnect = CCLink fullLink shortLink_, connLinkPreparedConnection, connLinkStartedConnection, welcomeSharedMsgId, requestSharedMsgId} _ -> Nothing -toGroupKeys :: GroupKeysRow -> (Maybe B64UrlByteString, Maybe GroupKeys) +toGroupKeys :: GroupKeysRow -> Maybe GroupKeys toGroupKeys = \case (Just sharedGroupId, rootPrivKey_, rootPubKey_, Just memberPrivKey) -> - ( Just sharedGroupId, - (\grk -> GroupKeys {sharedGroupId, groupRootKey = grk, memberPrivKey}) - <$> (GRKPrivate <$> rootPrivKey_ <|> GRKPublic <$> rootPubKey_) - ) - _ -> (Nothing, Nothing) + (\grk -> GroupKeys {sharedGroupId, groupRootKey = grk, memberPrivKey}) + <$> (GRKPrivate <$> rootPrivKey_ <|> GRKPublic <$> rootPubKey_) + _ -> Nothing toGroupMember :: Int64 -> GroupMemberRow -> GroupMember toGroupMember userContactId ((groupMemberId, groupId, indexInGroup, memberId, minVer, maxVer, memberRole, memberCategory, memberStatus, BI showMessages, memberRestriction_) :. (invitedById, invitedByGroupMemberId, localDisplayName, memberContactId, memberContactProfileId) :. profileRow :. (createdAt, updatedAt) :. (supportChatTs_, supportChatUnread, supportChatMemberAttention, supportChatMentions, supportChatLastMsgFromMemberTs, memberPubKey, relayLink)) =