From 92b66ef68d0b8464b6a7b000a140bb8bba6e08b6 Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Fri, 10 Jul 2026 22:21:09 +0000 Subject: [PATCH] core: preserve domain during group handshake --- src/Simplex/Chat/Store/Groups.hs | 6 +++++- src/Simplex/Chat/View.hs | 4 +++- tests/ChatTests/Names.hs | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Simplex/Chat/Store/Groups.hs b/src/Simplex/Chat/Store/Groups.hs index b10b7ad239..b4cdf91b8e 100644 --- a/src/Simplex/Chat/Store/Groups.hs +++ b/src/Simplex/Chat/Store/Groups.hs @@ -2721,7 +2721,11 @@ updateGroupProfile db user@User {userId} g@GroupInfo {groupId, localDisplayName, -- group_domain is owned by publicGroup; when the incoming profile has no publicGroup (a business, whose domain -- is set out-of-band) the CASE leaves the stored group_domain unchanged instead of clearing it. updateGroupProfile_ currentTs = - let (groupWebPage_, groupDomain_, domainWebPage_, allowEmbedding_, groupDomainProof_) = publicGroupAccessRow publicGroup + -- the wire carries the domain but not its signed proof (the group's link is authoritative for the claim), so + -- keep the stored proof on an unchanged domain instead of overwriting it with the empty incoming one, the same + -- way updateContactProfile preserves contactDomain's proof + let (groupWebPage_, groupDomain_, domainWebPage_, allowEmbedding_, _) = publicGroupAccessRow publicGroup + groupDomainProof_ = if claimChanged then Nothing else oldPublicGroup >>= publicGroupAccess >>= groupDomainClaim >>= proof in DB.execute db [sql| diff --git a/src/Simplex/Chat/View.hs b/src/Simplex/Chat/View.hs index 0edfff6d29..36dce4cfc5 100644 --- a/src/Simplex/Chat/View.hs +++ b/src/Simplex/Chat/View.hs @@ -1827,10 +1827,12 @@ viewContactInfo ct@Contact {contactId, profile = LocalProfile {localAlias, conta <> viewCustomData customData viewGroupInfo :: GroupInfo -> [StyledString] -viewGroupInfo gInfo@GroupInfo {groupId, uiThemes, customData, groupSummary = GroupSummary {currentMembers, publicMemberCount}} = +viewGroupInfo gInfo@GroupInfo {groupId, businessChat, groupDomainVerified, uiThemes, customData, groupSummary = GroupSummary {currentMembers, publicMemberCount}} = [ "group ID: " <> sShow groupId, memberCountLine ] + -- a business presents as a contact, so its verified domain is shown as an @-name + <> simplexDomainLine NTContact (businessDomain =<< businessChat) groupDomainVerified <> viewUITheme uiThemes <> viewCustomData customData where diff --git a/tests/ChatTests/Names.hs b/tests/ChatTests/Names.hs index 1de347e026..28f56c6fd1 100644 --- a/tests/ChatTests/Names.hs +++ b/tests/ChatTests/Names.hs @@ -239,5 +239,10 @@ testConnectByNameBusinessAndChannel ps = withSmpServerAndNames $ \reg -> bob ##> "/_connect plan 1 @biz.simplex resolve=never" bob <## "business address: known business #alice" bob <## "use #alice to send messages" + -- the business's verified domain survives the handshake and is shown in group info + bob ##> "/i #alice" + bob <## "group ID: 1" + bob <## "current members: 2" + bob <## "SimpleX name: @biz.simplex (verified)" where bizName = SimplexNameInfo NTContact (SimplexDomain TLDSimplex "biz" [])