core: fix connecting to prepared group incognito; test connecting to prepared contact incognito (#5994)

This commit is contained in:
spaced4ndy
2025-06-17 14:20:47 +00:00
committed by GitHub
parent e3e9ae2ffd
commit 94d866e2c0
9 changed files with 181 additions and 55 deletions
-22
View File
@@ -37,12 +37,10 @@ module Simplex.Chat.Store.Groups
deleteContactCardKeepConn,
createPreparedGroup,
updatePreparedGroupUser,
setGroupConnLinkStartedConnection,
updatePreparedUserAndHostMembersInvited,
updatePreparedUserAndHostMembersRejected,
createGroupInvitedViaLink,
createGroupRejectedViaLink,
setViaGroupLinkHash,
setGroupInvitationChatItemId,
getGroup,
getGroupInfo,
@@ -672,15 +670,6 @@ updatePreparedGroupUser db vr user gInfo@GroupInfo {groupId, membership} hostMem
(newUserId, currentTs, hostProfileId)
safeDeleteLDN db user oldHostLDN
setGroupConnLinkStartedConnection :: DB.Connection -> GroupInfo -> Bool -> IO GroupInfo
setGroupConnLinkStartedConnection db groupInfo@GroupInfo {groupId} connLinkStartedConnection = do
currentTs <- getCurrentTime
DB.execute
db
"UPDATE groups SET conn_link_started_connection = ?, updated_at = ? WHERE group_id = ?"
(BI connLinkStartedConnection, currentTs, groupId)
pure groupInfo {connLinkStartedConnection = connLinkStartedConnection}
updatePreparedUserAndHostMembersInvited :: DB.Connection -> VersionRangeChat -> User -> GroupInfo -> GroupMember -> GroupLinkInvitation -> ExceptT StoreError IO (GroupInfo, GroupMember)
updatePreparedUserAndHostMembersInvited db vr user gInfo hostMember GroupLinkInvitation {fromMember, fromMemberName, invitedMember, groupProfile, accepted} = do
let fromMemberProfile = profileFromName fromMemberName
@@ -815,17 +804,6 @@ createGroup_ db userId groupProfile connLinkToConnect business currentTs = Excep
groupId <- insertedRowId db
pure (groupId, localDisplayName)
setViaGroupLinkHash :: DB.Connection -> GroupId -> Int64 -> IO ()
setViaGroupLinkHash db groupId connId =
DB.execute
db
[sql|
UPDATE groups
SET via_group_link_uri_hash = (SELECT via_contact_uri_hash FROM connections WHERE connection_id = ?)
WHERE group_id = ?
|]
(connId, groupId)
setGroupInvitationChatItemId :: DB.Connection -> User -> GroupId -> ChatItemId -> IO ()
setGroupInvitationChatItemId db User {userId} groupId chatItemId = do
currentTs <- getCurrentTime