From 5d079a898beb25b61d42538b4704ea116d70e52b Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Thu, 28 May 2026 19:58:54 +0400 Subject: [PATCH] wip --- src/Simplex/Chat/Library/Subscriber.hs | 24 ++++++++++++------------ tests/ChatTests/Groups.hs | 14 +++++++------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Simplex/Chat/Library/Subscriber.hs b/src/Simplex/Chat/Library/Subscriber.hs index ab10152b11..71b9e8c8af 100644 --- a/src/Simplex/Chat/Library/Subscriber.hs +++ b/src/Simplex/Chat/Library/Subscriber.hs @@ -2981,18 +2981,18 @@ processAgentMessageConn vr user@User {userId} corrId agentConnId agentMessage = memberAnnouncedToView updatedMember gInfo' pure $ deliveryJobScope updatedMember else messageError "x.grp.mem.new: privileged role not established by roster" $> Nothing - Right unknownMember@GroupMember {memberStatus = GSMemUnknown} -> do - (updatedMember, gInfo') <- withStore $ \db -> do - updatedMember <- updateUnknownMemberAnnounced db vr user m unknownMember memInfo initialStatus - gInfo' <- - if memberPending updatedMember - then liftIO $ increaseGroupMembersRequireAttention db user gInfo - else pure gInfo - pure (updatedMember, gInfo') - gInfo'' <- updatePublicGroupData user gInfo' - toView $ CEvtUnknownMemberAnnounced user gInfo'' m unknownMember updatedMember - memberAnnouncedToView updatedMember gInfo'' - pure $ deliveryJobScope updatedMember + | otherwise -> do + (updatedMember, gInfo') <- withStore $ \db -> do + updatedMember <- updateUnknownMemberAnnounced db vr user m unknownMember memInfo initialStatus + gInfo' <- + if memberPending updatedMember + then liftIO $ increaseGroupMembersRequireAttention db user gInfo + else pure gInfo + pure (updatedMember, gInfo') + gInfo'' <- updatePublicGroupData user gInfo' + toView $ CEvtUnknownMemberAnnounced user gInfo'' m unknownMember updatedMember + memberAnnouncedToView updatedMember gInfo'' + pure $ deliveryJobScope updatedMember Right _ | useRelays' gInfo -> logInfo "x.grp.mem.new: member already created via another relay" $> Nothing | otherwise -> messageError "x.grp.mem.new error: member already exists" $> Nothing diff --git a/tests/ChatTests/Groups.hs b/tests/ChatTests/Groups.hs index 7bd267257a..2829c2a40c 100644 --- a/tests/ChatTests/Groups.hs +++ b/tests/ChatTests/Groups.hs @@ -9525,11 +9525,11 @@ testChannelModeratorActionViaRoster ps = cath <## "#team: you blocked dan (signed)" bob <## "#team: cath blocked dan (signed)" alice <## "#team: cath blocked dan (signed)" - eve <##. "#team: unknown member cath" - eve <##. "#team: bob introduced cath" + eve <## "#team: unknown member cath updated to cath" + eve <## "#team: bob introduced cath (Catherine) in the channel" eve <## "#team: cath blocked dan (signed)" - dan <##. "#team: unknown member cath" - dan <##. "#team: bob introduced cath" + dan <## "#team: unknown member cath updated to cath" + dan <## "#team: bob introduced cath (Catherine) in the channel" -- frank joins after the roster update; cached roster gives him cath as moderator. -- both alice (owner) and cath (mod) receive XGrpMemNew(frank) via introduceInChannel @@ -9567,13 +9567,13 @@ testChannelRemovedModeratorRefreshesRoster ps = bob <## "#team: alice removed cath from the group (signed)" cath <## "#team: alice removed you from the group (signed)" cath <## "use /d #team to delete the group" - dan .<##. ("#team: alice removed cath", "(signed)") - eve .<##. ("#team: alice removed cath", "(signed)") + dan <## "#team: alice removed cath from the group (signed)" + eve <## "#team: alice removed cath from the group (signed)" -- frank joins after the removal; cached roster has dropped cath threadDelay 1000000 memberJoinChannel "team" [bob] [alice] shortLink fullLink frank - threadDelay 500000 + threadDelay 100000 checkMemberRow frank "cath" Nothing where checkMemberRow :: HasCallStack => TestCC -> T.Text -> Maybe T.Text -> IO ()