mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-22 13:11:55 +00:00
core: don't save owner key as passed by relay, if owner record doesn't exist (#6806)
This commit is contained in:
1 parent
79a9860159
commit
424b869750
2 files changed
+11
-2
No files matched your search
@@ -2900,8 +2900,13 @@ processAgentMessageConn vr user@User {userId} corrId agentConnId agentMessage =
|
||||
| otherwise ->
|
||||
messageError "x.grp.mem.intro ignored: member already exists"
|
||||
Left _
|
||||
| useRelays' gInfo ->
|
||||
void $ withStore $ \db -> createIntroReMember db user gInfo memInfo memRestrictions
|
||||
| useRelays' gInfo -> do
|
||||
-- owner key must only come from link data, not from relay intro
|
||||
let memInfo' = case memInfo of
|
||||
MemberInfo mId mRole v p _
|
||||
| mRole == GROwner -> MemberInfo mId mRole v p Nothing
|
||||
_ -> memInfo
|
||||
void $ withStore $ \db -> createIntroReMember db user gInfo memInfo' memRestrictions
|
||||
| otherwise -> do
|
||||
when (memberRole < GRAdmin) $ throwChatError (CEGroupContactRole c)
|
||||
case memChatVRange of
|
||||
|
||||
@@ -8854,6 +8854,8 @@ testChannelOwnerKeyAfterLinkUpdate ps =
|
||||
(shortLink, fullLink) <- prepareChannel1Relay "team" alice bob
|
||||
memberJoinChannel "team" [bob] [alice] shortLink fullLink cath
|
||||
|
||||
threadDelay 100000
|
||||
|
||||
-- Owner updates channel profile - triggers rebuilding link data.
|
||||
alice ##> "/gp team my_team My team description"
|
||||
alice <## "changed to #my_team (My team description)"
|
||||
@@ -8875,6 +8877,8 @@ testChannelOwnerKeyAfterLinkUpdate ps =
|
||||
fullLink' `shouldBe` fullLink
|
||||
memberJoinChannel "my_team" [bob] [alice] shortLink' fullLink' dan
|
||||
|
||||
threadDelay 100000
|
||||
|
||||
-- Verify owner member record in late subscriber's DB has a public key.
|
||||
ownerKeyPresent <- withCCTransaction dan $ \db ->
|
||||
DB.query_ db "SELECT COUNT(1) FROM group_members WHERE member_role = 'owner' AND member_pub_key IS NOT NULL" :: IO [[Int]]
|
||||
|
||||
Reference in new issue
Block a user