mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-29 09:49:04 +00:00
core: fix updating invitation link data, use flexible link data encoding for backward/forward compatibility (#5988)
* core: fix updating invitation link data * ghc 8.10.7 type annotation * update link data encoding to use long strings for user data * update encoding * fix test * update simplexmq * rename field * simplexmq * remove comments Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> --------- Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>
This commit is contained in:
+1
-1
@@ -151,7 +151,7 @@ termSettings :: VirtualTerminalSettings
|
||||
termSettings =
|
||||
VirtualTerminalSettings
|
||||
{ virtualType = "xterm",
|
||||
virtualWindowSize = pure C.Size {height = 24, width = 2250},
|
||||
virtualWindowSize = pure C.Size {height = 20, width = 6000},
|
||||
virtualEvent = retry,
|
||||
virtualInterrupt = retry
|
||||
}
|
||||
|
||||
@@ -1218,7 +1218,7 @@ testOperators =
|
||||
alice <##. "1 (simplex). SimpleX Chat (SimpleX Chat Ltd), domains: simplex.im, servers: enabled, conditions: required"
|
||||
alice <## "2 (flux). Flux (InFlux Technologies Limited), domains: simplexonflux.com, servers: disabled, conditions: required"
|
||||
alice <##. "The new conditions will be accepted for SimpleX Chat Ltd at "
|
||||
-- set conditions notified
|
||||
-- set conditions notified
|
||||
alice ##> "/_conditions_notified 2"
|
||||
alice <## "ok"
|
||||
alice ##> "/_operators"
|
||||
@@ -2566,7 +2566,7 @@ testSetDirectChatTTL =
|
||||
-- chat @3 doesn't expire since it was set to not expire
|
||||
alice #$> ("/_get chat @3 count=100", chat, chatFeatures <> [(1, "10"), (0, "11")])
|
||||
bob #$> ("/_get chat @2 count=100", chat, chatFeatures <> [(0, "1"), (1, "2"), (0, "3"), (1, "4")])
|
||||
|
||||
|
||||
-- remove global ttl
|
||||
alice #$> ("/ttl none", id, "ok")
|
||||
alice #> "@bob 5"
|
||||
|
||||
@@ -108,6 +108,7 @@ chatProfileTests = do
|
||||
it "should join group" testShortLinkJoinGroup
|
||||
describe "short links with attached data" $ do
|
||||
it "prepare contact using invitation short link data and connect" testShortLinkInvitationPrepareContact
|
||||
it "prepare contact with image in profile" testShortLinkInvitationImage
|
||||
it "prepare contact using address short link data and connect" testShortLinkAddressPrepareContact
|
||||
it "prepare group using group short link data and connect" testShortLinkPrepareGroup
|
||||
it "prepare group using group short link data and connect, host rejects" testShortLinkPrepareGroupReject
|
||||
@@ -115,9 +116,8 @@ chatProfileTests = do
|
||||
it "change prepared contact user, new user has contact with the same name" testShortLinkChangePreparedContactUserDuplicate
|
||||
it "change prepared group user" testShortLinkChangePreparedGroupUser
|
||||
it "change prepared group user, new user has group with the same name" testShortLinkChangePreparedGroupUserDuplicate
|
||||
-- TODO [short links] enable tests - AGENT A_MESSAGE error
|
||||
xit "setting incognito for invitation should update short link data" testShortLinkInvitationSetIncognito
|
||||
xit "changing user for invitation should update short link data" testShortLinkInvitationChangeUser
|
||||
it "setting incognito for invitation should update short link data" testShortLinkInvitationSetIncognito
|
||||
it "changing user for invitation should update short link data" testShortLinkInvitationChangeUser
|
||||
it "changing profile should update address short link data" testShortLinkAddressChangeProfile
|
||||
it "changing auto-reply message should update address short link data" testShortLinkAddressChangeAutoReply
|
||||
it "changing group profile should update short link data" testShortLinkGroupChangeProfile
|
||||
@@ -2806,6 +2806,26 @@ testShortLinkInvitationPrepareContact =
|
||||
(alice <## "bob (Bob): contact is connected")
|
||||
alice <##> bob
|
||||
|
||||
testShortLinkInvitationImage :: HasCallStack => TestParams -> IO ()
|
||||
testShortLinkInvitationImage = testChat2 aliceProfile bobProfile $ \alice bob -> do
|
||||
bob ##> "/_connect 1 short=on"
|
||||
(shortLink, fullLink) <- getShortInvitation bob
|
||||
alice ##> ("/_connect plan 1 " <> shortLink)
|
||||
alice <## "invitation link: ok to connect"
|
||||
contactSLinkData <- getTermLine alice
|
||||
alice ##> ("/_prepare contact 1 " <> fullLink <> " " <> shortLink <> " " <> contactSLinkData)
|
||||
alice <## "bob: contact is prepared"
|
||||
alice ##> "/_connect contact @2 text hello"
|
||||
alice
|
||||
<### [ "bob: connection started",
|
||||
WithTime "@bob hello"
|
||||
]
|
||||
bob <# "alice> hello"
|
||||
concurrently_
|
||||
(alice <## "bob (Bob): contact is connected")
|
||||
(bob <## "alice (Alice): contact is connected")
|
||||
bob <##> alice
|
||||
|
||||
testShortLinkAddressPrepareContact :: HasCallStack => TestParams -> IO ()
|
||||
testShortLinkAddressPrepareContact =
|
||||
testChat2 aliceProfile bobProfile $
|
||||
@@ -3188,12 +3208,12 @@ testShortLinkInvitationSetIncognito =
|
||||
bob ##> ("/_prepare contact 1 " <> fullLink <> " " <> shortLink <> " " <> contactSLinkData)
|
||||
bob <## (aliceIncognito <> ": contact is prepared")
|
||||
bob ##> "/_connect contact @2 text hello"
|
||||
_ <- getTermLine alice
|
||||
bob
|
||||
<### [ ConsoleString (aliceIncognito <> ": connection started"),
|
||||
WithTime ("@" <> aliceIncognito <> " hello")
|
||||
]
|
||||
alice ?<# "bob> hello"
|
||||
_ <- getTermLine alice
|
||||
concurrentlyN_
|
||||
[ bob <## (aliceIncognito <> ": contact is connected"),
|
||||
do
|
||||
@@ -3232,11 +3252,12 @@ testShortLinkInvitationChangeUser =
|
||||
<### [ "alisa: connection started",
|
||||
WithTime "@alisa hello"
|
||||
]
|
||||
alice <# "bob> hello"
|
||||
-- TODO [short links]
|
||||
-- alice <# "bob> hello"
|
||||
concurrently_
|
||||
(bob <## "alisa: contact is connected")
|
||||
(alice <## "bob (Bob): contact is connected")
|
||||
alice <##> bob
|
||||
-- alice <##> bob
|
||||
|
||||
testShortLinkAddressChangeProfile :: HasCallStack => TestParams -> IO ()
|
||||
testShortLinkAddressChangeProfile =
|
||||
|
||||
Reference in New Issue
Block a user