toGroupKeys

This commit is contained in:
Evgeny Poberezkin
2026-03-28 21:11:56 +00:00
parent e79849854f
commit 5afe969aa6
+6 -7
View File
@@ -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)) =