core: don't keep connection of the merged contact (#2507)
This commit is contained in:
parent
f9f34911b1
commit
6093219ce9
@ -196,8 +196,8 @@ fun ChatInfoLayout(
|
|||||||
}
|
}
|
||||||
ContactPreferencesButton(openPreferences)
|
ContactPreferencesButton(openPreferences)
|
||||||
}
|
}
|
||||||
|
|
||||||
SectionDividerSpaced()
|
SectionDividerSpaced()
|
||||||
|
|
||||||
if (contact.contactLink != null) {
|
if (contact.contactLink != null) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
SectionView(stringResource(R.string.address_section_title).uppercase()) {
|
SectionView(stringResource(R.string.address_section_title).uppercase()) {
|
||||||
@ -208,6 +208,17 @@ fun ChatInfoLayout(
|
|||||||
SectionDividerSpaced()
|
SectionDividerSpaced()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (developerTools) {
|
||||||
|
SectionView(title = stringResource(R.string.contact_info_section_title_contact)) {
|
||||||
|
val connLevel = contact.activeConn.connLevel
|
||||||
|
val connLevelDesc =
|
||||||
|
if (connLevel == 0) stringResource(R.string.conn_level_desc_direct)
|
||||||
|
else String.format(generalGetString(R.string.conn_level_desc_indirect), connLevel)
|
||||||
|
InfoRow(stringResource(R.string.info_row_connection), connLevelDesc)
|
||||||
|
}
|
||||||
|
SectionDividerSpaced()
|
||||||
|
}
|
||||||
|
|
||||||
SectionView(title = stringResource(R.string.conn_stats_section_title_servers)) {
|
SectionView(title = stringResource(R.string.conn_stats_section_title_servers)) {
|
||||||
SwitchAddressButton(switchContactAddress)
|
SwitchAddressButton(switchContactAddress)
|
||||||
if (connStats != null) {
|
if (connStats != null) {
|
||||||
|
@ -1140,6 +1140,7 @@
|
|||||||
<string name="member_will_be_removed_from_group_cannot_be_undone">Member will be removed from group - this cannot be undone!</string>
|
<string name="member_will_be_removed_from_group_cannot_be_undone">Member will be removed from group - this cannot be undone!</string>
|
||||||
<string name="remove_member_confirmation">Remove</string>
|
<string name="remove_member_confirmation">Remove</string>
|
||||||
<string name="member_info_section_title_member">MEMBER</string>
|
<string name="member_info_section_title_member">MEMBER</string>
|
||||||
|
<string name="contact_info_section_title_contact">CONTACT</string>
|
||||||
<string name="role_in_group">Role</string>
|
<string name="role_in_group">Role</string>
|
||||||
<string name="change_role">Change role</string>
|
<string name="change_role">Change role</string>
|
||||||
<string name="change_verb">Change</string>
|
<string name="change_verb">Change</string>
|
||||||
|
@ -131,6 +131,14 @@ struct ChatInfoView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if developerTools {
|
||||||
|
Section("Contact") {
|
||||||
|
let connLevel = contact.activeConn.connLevel
|
||||||
|
let connLevelDesc = connLevel == 0 ? NSLocalizedString("direct", comment: "connection level description") : String.localizedStringWithFormat(NSLocalizedString("indirect (%d)", comment: "connection level description"), connLevel)
|
||||||
|
infoRow("Connection", connLevelDesc)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Section("Servers") {
|
Section("Servers") {
|
||||||
networkStatusRow()
|
networkStatusRow()
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
|
@ -2656,7 +2656,7 @@ processAgentMessageConn user@User {userId} corrId agentConnId agentMessage = do
|
|||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
|
|
||||||
processDirectMessage :: ACommand 'Agent e -> ConnectionEntity -> Connection -> Maybe Contact -> m ()
|
processDirectMessage :: ACommand 'Agent e -> ConnectionEntity -> Connection -> Maybe Contact -> m ()
|
||||||
processDirectMessage agentMsg connEntity conn@Connection {connId, viaUserContactLink, groupLinkId, customUserProfileId} = \case
|
processDirectMessage agentMsg connEntity conn@Connection {connId, viaUserContactLink, customUserProfileId} = \case
|
||||||
Nothing -> case agentMsg of
|
Nothing -> case agentMsg of
|
||||||
CONF confId _ connInfo -> do
|
CONF confId _ connInfo -> do
|
||||||
-- [incognito] send saved profile
|
-- [incognito] send saved profile
|
||||||
@ -2758,7 +2758,6 @@ processAgentMessageConn user@User {userId} corrId agentConnId agentMessage = do
|
|||||||
whenUserNtfs user $ do
|
whenUserNtfs user $ do
|
||||||
setActive $ ActiveC c
|
setActive $ ActiveC c
|
||||||
showToast (c <> "> ") "connected"
|
showToast (c <> "> ") "connected"
|
||||||
forM_ groupLinkId $ \_ -> probeMatchingContacts ct $ contactConnIncognito ct
|
|
||||||
forM_ viaUserContactLink $ \userContactLinkId ->
|
forM_ viaUserContactLink $ \userContactLinkId ->
|
||||||
withStore' (\db -> getUserContactLinkById db userId userContactLinkId) >>= \case
|
withStore' (\db -> getUserContactLinkById db userId userContactLinkId) >>= \case
|
||||||
Just (UserContactLink {autoAccept = Just AutoAccept {autoReply = mc_}}, groupId_, gLinkMemRole) -> do
|
Just (UserContactLink {autoAccept = Just AutoAccept {autoReply = mc_}}, groupId_, gLinkMemRole) -> do
|
||||||
@ -2903,6 +2902,11 @@ processAgentMessageConn user@User {userId} corrId agentConnId agentMessage = do
|
|||||||
whenUserNtfs user $ do
|
whenUserNtfs user $ do
|
||||||
setActive $ ActiveG gName
|
setActive $ ActiveG gName
|
||||||
showToast ("#" <> gName) "you are connected to group"
|
showToast ("#" <> gName) "you are connected to group"
|
||||||
|
withStore' (\db -> getContactViaMember db user m) >>= \case
|
||||||
|
Nothing -> messageWarning "connected host does not have contact"
|
||||||
|
Just ct@Contact {activeConn = Connection {groupLinkId}} -> do
|
||||||
|
let connectedIncognito = contactConnIncognito ct || memberIncognito membership
|
||||||
|
forM_ groupLinkId $ \_ -> probeMatchingContacts ct connectedIncognito
|
||||||
GCInviteeMember -> do
|
GCInviteeMember -> do
|
||||||
memberConnectedChatItem gInfo m
|
memberConnectedChatItem gInfo m
|
||||||
toView $ CRJoinedGroupMember user gInfo m {memberStatus = GSMemConnected}
|
toView $ CRJoinedGroupMember user gInfo m {memberStatus = GSMemConnected}
|
||||||
@ -3825,8 +3829,9 @@ processAgentMessageConn user@User {userId} corrId agentConnId agentMessage = do
|
|||||||
probeMatch c1@Contact {contactId = cId1, profile = p1} c2@Contact {contactId = cId2, profile = p2} probe =
|
probeMatch c1@Contact {contactId = cId1, profile = p1} c2@Contact {contactId = cId2, profile = p2} probe =
|
||||||
if profilesMatch (fromLocalProfile p1) (fromLocalProfile p2) && cId1 /= cId2
|
if profilesMatch (fromLocalProfile p1) (fromLocalProfile p2) && cId1 /= cId2
|
||||||
then do
|
then do
|
||||||
void . sendDirectContactMessage c1 $ XInfoProbeOk probe
|
let (toCt, fromCt) = mergeToFromContacts c1 c2
|
||||||
mergeContacts c1 c2
|
void . sendDirectContactMessage toCt $ XInfoProbeOk probe
|
||||||
|
mergeContacts toCt fromCt
|
||||||
else messageWarning "probeMatch ignored: profiles don't match or same contact id"
|
else messageWarning "probeMatch ignored: profiles don't match or same contact id"
|
||||||
|
|
||||||
xInfoProbeOk :: Contact -> Probe -> m ()
|
xInfoProbeOk :: Contact -> Probe -> m ()
|
||||||
@ -3834,9 +3839,22 @@ processAgentMessageConn user@User {userId} corrId agentConnId agentMessage = do
|
|||||||
r <- withStore' $ \db -> matchSentProbe db user c1 probe
|
r <- withStore' $ \db -> matchSentProbe db user c1 probe
|
||||||
forM_ r $ \c2@Contact {contactId = cId2} ->
|
forM_ r $ \c2@Contact {contactId = cId2} ->
|
||||||
if cId1 /= cId2
|
if cId1 /= cId2
|
||||||
then mergeContacts c1 c2
|
then do
|
||||||
|
let (toCt, fromCt) = mergeToFromContacts c1 c2
|
||||||
|
mergeContacts toCt fromCt
|
||||||
else messageWarning "xInfoProbeOk ignored: same contact id"
|
else messageWarning "xInfoProbeOk ignored: same contact id"
|
||||||
|
|
||||||
|
mergeToFromContacts :: Contact -> Contact -> (Contact, Contact)
|
||||||
|
mergeToFromContacts c1 c2
|
||||||
|
| d1 && not d2 = (c1, c2)
|
||||||
|
| d2 && not d1 = (c2, c1)
|
||||||
|
| ctCreatedAt c1 <= ctCreatedAt c2 = (c1, c2)
|
||||||
|
| otherwise = (c2, c1)
|
||||||
|
where
|
||||||
|
d1 = directOrUsed c1
|
||||||
|
d2 = directOrUsed c2
|
||||||
|
ctCreatedAt Contact {createdAt} = createdAt
|
||||||
|
|
||||||
-- to party accepting call
|
-- to party accepting call
|
||||||
xCallInv :: Contact -> CallId -> CallInvitation -> RcvMessage -> MsgMeta -> m ()
|
xCallInv :: Contact -> CallId -> CallInvitation -> RcvMessage -> MsgMeta -> m ()
|
||||||
xCallInv ct@Contact {contactId} callId CallInvitation {callType, callDhPubKey} msg@RcvMessage {sharedMsgId_} msgMeta = do
|
xCallInv ct@Contact {contactId} callId CallInvitation {callType, callDhPubKey} msg@RcvMessage {sharedMsgId_} msgMeta = do
|
||||||
@ -3943,9 +3961,10 @@ processAgentMessageConn user@User {userId} corrId agentConnId agentMessage = do
|
|||||||
messageError $ eventName <> ": wrong call state " <> T.pack (show $ callStateTag callState)
|
messageError $ eventName <> ": wrong call state " <> T.pack (show $ callStateTag callState)
|
||||||
|
|
||||||
mergeContacts :: Contact -> Contact -> m ()
|
mergeContacts :: Contact -> Contact -> m ()
|
||||||
mergeContacts c1 c2 = do
|
mergeContacts toCt fromCt = do
|
||||||
withStore' $ \db -> mergeContactRecords db userId c1 c2
|
deleteAgentConnectionAsync user $ aConnId $ contactConn fromCt
|
||||||
toView $ CRContactsMerged user c1 c2
|
withStore' $ \db -> mergeContactRecords db userId toCt fromCt
|
||||||
|
toView $ CRContactsMerged user toCt fromCt
|
||||||
|
|
||||||
saveConnInfo :: Connection -> ConnInfo -> m ()
|
saveConnInfo :: Connection -> ConnInfo -> m ()
|
||||||
saveConnInfo activeConn connInfo = do
|
saveConnInfo activeConn connInfo = do
|
||||||
|
@ -1708,9 +1708,8 @@ matchSentProbe db user@User {userId} _from@Contact {contactId} (Probe probe) = d
|
|||||||
cId : _ -> eitherToMaybe <$> runExceptT (getContact db user cId)
|
cId : _ -> eitherToMaybe <$> runExceptT (getContact db user cId)
|
||||||
|
|
||||||
mergeContactRecords :: DB.Connection -> UserId -> Contact -> Contact -> IO ()
|
mergeContactRecords :: DB.Connection -> UserId -> Contact -> Contact -> IO ()
|
||||||
mergeContactRecords db userId ct1 ct2 = do
|
mergeContactRecords db userId toCt fromCt = do
|
||||||
let (toCt, fromCt) = toFromContacts ct1 ct2
|
let Contact {contactId = toContactId} = toCt
|
||||||
Contact {contactId = toContactId} = toCt
|
|
||||||
Contact {contactId = fromContactId, localDisplayName} = fromCt
|
Contact {contactId = fromContactId, localDisplayName} = fromCt
|
||||||
currentTs <- getCurrentTime
|
currentTs <- getCurrentTime
|
||||||
-- TODO next query fixes incorrect unused contacts deletion; consider more thorough fix
|
-- TODO next query fixes incorrect unused contacts deletion; consider more thorough fix
|
||||||
@ -1719,10 +1718,6 @@ mergeContactRecords db userId ct1 ct2 = do
|
|||||||
db
|
db
|
||||||
"UPDATE contacts SET contact_used = 1, updated_at = ? WHERE user_id = ? AND contact_id = ?"
|
"UPDATE contacts SET contact_used = 1, updated_at = ? WHERE user_id = ? AND contact_id = ?"
|
||||||
(currentTs, userId, toContactId)
|
(currentTs, userId, toContactId)
|
||||||
DB.execute
|
|
||||||
db
|
|
||||||
"UPDATE connections SET contact_id = ?, updated_at = ? WHERE contact_id = ? AND user_id = ?"
|
|
||||||
(toContactId, currentTs, fromContactId, userId)
|
|
||||||
DB.execute
|
DB.execute
|
||||||
db
|
db
|
||||||
"UPDATE connections SET via_contact = ?, updated_at = ? WHERE via_contact = ? AND user_id = ?"
|
"UPDATE connections SET via_contact = ?, updated_at = ? WHERE via_contact = ? AND user_id = ?"
|
||||||
@ -1735,6 +1730,10 @@ mergeContactRecords db userId ct1 ct2 = do
|
|||||||
db
|
db
|
||||||
"UPDATE chat_items SET contact_id = ?, updated_at = ? WHERE contact_id = ? AND user_id = ?"
|
"UPDATE chat_items SET contact_id = ?, updated_at = ? WHERE contact_id = ? AND user_id = ?"
|
||||||
(toContactId, currentTs, fromContactId, userId)
|
(toContactId, currentTs, fromContactId, userId)
|
||||||
|
DB.execute
|
||||||
|
db
|
||||||
|
"UPDATE chat_item_reactions SET contact_id = ?, updated_at = ? WHERE contact_id = ?"
|
||||||
|
(toContactId, currentTs, fromContactId)
|
||||||
DB.executeNamed
|
DB.executeNamed
|
||||||
db
|
db
|
||||||
[sql|
|
[sql|
|
||||||
@ -1754,17 +1753,6 @@ mergeContactRecords db userId ct1 ct2 = do
|
|||||||
deleteContactProfile_ db userId fromContactId
|
deleteContactProfile_ db userId fromContactId
|
||||||
DB.execute db "DELETE FROM contacts WHERE contact_id = ? AND user_id = ?" (fromContactId, userId)
|
DB.execute db "DELETE FROM contacts WHERE contact_id = ? AND user_id = ?" (fromContactId, userId)
|
||||||
DB.execute db "DELETE FROM display_names WHERE local_display_name = ? AND user_id = ?" (localDisplayName, userId)
|
DB.execute db "DELETE FROM display_names WHERE local_display_name = ? AND user_id = ?" (localDisplayName, userId)
|
||||||
where
|
|
||||||
toFromContacts :: Contact -> Contact -> (Contact, Contact)
|
|
||||||
toFromContacts c1 c2
|
|
||||||
| d1 && not d2 = (c1, c2)
|
|
||||||
| d2 && not d1 = (c2, c1)
|
|
||||||
| ctCreatedAt c1 <= ctCreatedAt c2 = (c1, c2)
|
|
||||||
| otherwise = (c2, c1)
|
|
||||||
where
|
|
||||||
d1 = directOrUsed c1
|
|
||||||
d2 = directOrUsed c2
|
|
||||||
ctCreatedAt Contact {createdAt} = createdAt
|
|
||||||
|
|
||||||
getConnectionEntity :: DB.Connection -> User -> AgentConnId -> ExceptT StoreError IO ConnectionEntity
|
getConnectionEntity :: DB.Connection -> User -> AgentConnId -> ExceptT StoreError IO ConnectionEntity
|
||||||
getConnectionEntity db user@User {userId, userContactId} agentConnId = do
|
getConnectionEntity db user@User {userId, userContactId} agentConnId = do
|
||||||
@ -2364,6 +2352,7 @@ createNewContactMemberAsync db gVar user@User {userId, userContactId} groupId Co
|
|||||||
:. (userId, localDisplayName, contactId, localProfileId profile, createdAt, createdAt)
|
:. (userId, localDisplayName, contactId, localProfileId profile, createdAt, createdAt)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
-- this method differs from getViaGroupContact in that it does not join with groups on contacts.via_group
|
||||||
getContactViaMember :: DB.Connection -> User -> GroupMember -> IO (Maybe Contact)
|
getContactViaMember :: DB.Connection -> User -> GroupMember -> IO (Maybe Contact)
|
||||||
getContactViaMember db user@User {userId} GroupMember {groupMemberId} =
|
getContactViaMember db user@User {userId} GroupMember {groupMemberId} =
|
||||||
maybeFirstRow (toContact user) $
|
maybeFirstRow (toContact user) $
|
||||||
|
@ -116,11 +116,7 @@ responseToView user_ ChatConfig {logLevel, showReactions, testView} liveItems ts
|
|||||||
CRGroupCreated u g -> ttyUser u $ viewGroupCreated g
|
CRGroupCreated u g -> ttyUser u $ viewGroupCreated g
|
||||||
CRGroupMembers u g -> ttyUser u $ viewGroupMembers g
|
CRGroupMembers u g -> ttyUser u $ viewGroupMembers g
|
||||||
CRGroupsList u gs -> ttyUser u $ viewGroupsList gs
|
CRGroupsList u gs -> ttyUser u $ viewGroupsList gs
|
||||||
CRSentGroupInvitation u g c _ ->
|
CRSentGroupInvitation u g c _ -> ttyUser u ["invitation to join the group " <> ttyGroup' g <> " sent to " <> ttyContact' c]
|
||||||
ttyUser u $
|
|
||||||
if viaGroupLink . contactConn $ c
|
|
||||||
then [ttyContact' c <> " invited to group " <> ttyGroup' g <> " via your group link"]
|
|
||||||
else ["invitation to join the group " <> ttyGroup' g <> " sent to " <> ttyContact' c]
|
|
||||||
CRFileTransferStatus u ftStatus -> ttyUser u $ viewFileTransferStatus ftStatus
|
CRFileTransferStatus u ftStatus -> ttyUser u $ viewFileTransferStatus ftStatus
|
||||||
CRFileTransferStatusXFTP u ci -> ttyUser u $ viewFileTransferStatusXFTP ci
|
CRFileTransferStatusXFTP u ci -> ttyUser u $ viewFileTransferStatusXFTP ci
|
||||||
CRUserProfile u p -> ttyUser u $ viewUserProfile p
|
CRUserProfile u p -> ttyUser u $ viewUserProfile p
|
||||||
|
@ -1544,7 +1544,7 @@ testGroupLink =
|
|||||||
concurrentlyN_
|
concurrentlyN_
|
||||||
[ do
|
[ do
|
||||||
alice <## "bob (Bob): contact is connected"
|
alice <## "bob (Bob): contact is connected"
|
||||||
alice <## "bob invited to group #team via your group link"
|
alice <## "invitation to join the group #team sent to bob"
|
||||||
alice <## "#team: bob joined the group",
|
alice <## "#team: bob joined the group",
|
||||||
do
|
do
|
||||||
bob <## "alice (Alice): contact is connected"
|
bob <## "alice (Alice): contact is connected"
|
||||||
@ -1580,7 +1580,7 @@ testGroupLink =
|
|||||||
<### [ "cath_1 (Catherine): contact is connected",
|
<### [ "cath_1 (Catherine): contact is connected",
|
||||||
"contact cath_1 is merged into cath",
|
"contact cath_1 is merged into cath",
|
||||||
"use @cath <message> to send messages",
|
"use @cath <message> to send messages",
|
||||||
EndsWith "invited to group #team via your group link",
|
StartsWith "invitation to join the group #team sent to cath",
|
||||||
EndsWith "joined the group"
|
EndsWith "joined the group"
|
||||||
],
|
],
|
||||||
cath
|
cath
|
||||||
@ -1634,7 +1634,7 @@ testGroupLinkDeleteGroupRejoin =
|
|||||||
concurrentlyN_
|
concurrentlyN_
|
||||||
[ do
|
[ do
|
||||||
alice <## "bob (Bob): contact is connected"
|
alice <## "bob (Bob): contact is connected"
|
||||||
alice <## "bob invited to group #team via your group link"
|
alice <## "invitation to join the group #team sent to bob"
|
||||||
alice <## "#team: bob joined the group",
|
alice <## "#team: bob joined the group",
|
||||||
do
|
do
|
||||||
bob <## "alice (Alice): contact is connected"
|
bob <## "alice (Alice): contact is connected"
|
||||||
@ -1660,7 +1660,7 @@ testGroupLinkDeleteGroupRejoin =
|
|||||||
<### [ "bob_1 (Bob): contact is connected",
|
<### [ "bob_1 (Bob): contact is connected",
|
||||||
"contact bob_1 is merged into bob",
|
"contact bob_1 is merged into bob",
|
||||||
"use @bob <message> to send messages",
|
"use @bob <message> to send messages",
|
||||||
EndsWith "invited to group #team via your group link",
|
StartsWith "invitation to join the group #team sent to bob",
|
||||||
EndsWith "joined the group"
|
EndsWith "joined the group"
|
||||||
],
|
],
|
||||||
bob
|
bob
|
||||||
@ -1690,7 +1690,7 @@ testGroupLinkContactUsed =
|
|||||||
concurrentlyN_
|
concurrentlyN_
|
||||||
[ do
|
[ do
|
||||||
alice <## "bob (Bob): contact is connected"
|
alice <## "bob (Bob): contact is connected"
|
||||||
alice <## "bob invited to group #team via your group link"
|
alice <## "invitation to join the group #team sent to bob"
|
||||||
alice <## "#team: bob joined the group",
|
alice <## "#team: bob joined the group",
|
||||||
do
|
do
|
||||||
bob <## "alice (Alice): contact is connected"
|
bob <## "alice (Alice): contact is connected"
|
||||||
@ -1752,7 +1752,7 @@ testGroupLinkIncognitoMembership =
|
|||||||
[ do
|
[ do
|
||||||
bob <## ("cath (Catherine): contact is connected, your incognito profile for this contact is " <> bobIncognito)
|
bob <## ("cath (Catherine): contact is connected, your incognito profile for this contact is " <> bobIncognito)
|
||||||
bob <## "use /i cath to print out this incognito profile again"
|
bob <## "use /i cath to print out this incognito profile again"
|
||||||
bob <## "cath invited to group #team via your group link"
|
bob <## "invitation to join the group #team sent to cath"
|
||||||
bob <## "#team: cath joined the group",
|
bob <## "#team: cath joined the group",
|
||||||
do
|
do
|
||||||
cath <## (bobIncognito <> ": contact is connected")
|
cath <## (bobIncognito <> ": contact is connected")
|
||||||
@ -1778,7 +1778,7 @@ testGroupLinkIncognitoMembership =
|
|||||||
[ do
|
[ do
|
||||||
bob <## (danIncognito <> ": contact is connected, your incognito profile for this contact is " <> bobIncognito)
|
bob <## (danIncognito <> ": contact is connected, your incognito profile for this contact is " <> bobIncognito)
|
||||||
bob <## ("use /i " <> danIncognito <> " to print out this incognito profile again")
|
bob <## ("use /i " <> danIncognito <> " to print out this incognito profile again")
|
||||||
bob <## (danIncognito <> " invited to group #team via your group link")
|
bob <## ("invitation to join the group #team sent to " <> danIncognito)
|
||||||
bob <## ("#team: " <> danIncognito <> " joined the group"),
|
bob <## ("#team: " <> danIncognito <> " joined the group"),
|
||||||
do
|
do
|
||||||
dan <## (bobIncognito <> ": contact is connected, your incognito profile for this contact is " <> danIncognito)
|
dan <## (bobIncognito <> ": contact is connected, your incognito profile for this contact is " <> danIncognito)
|
||||||
@ -1841,7 +1841,7 @@ testGroupLinkUnusedHostContactDeleted =
|
|||||||
concurrentlyN_
|
concurrentlyN_
|
||||||
[ do
|
[ do
|
||||||
alice <## "bob (Bob): contact is connected"
|
alice <## "bob (Bob): contact is connected"
|
||||||
alice <## "bob invited to group #team via your group link"
|
alice <## "invitation to join the group #team sent to bob"
|
||||||
alice <## "#team: bob joined the group",
|
alice <## "#team: bob joined the group",
|
||||||
do
|
do
|
||||||
bob <## "alice (Alice): contact is connected"
|
bob <## "alice (Alice): contact is connected"
|
||||||
@ -1861,7 +1861,7 @@ testGroupLinkUnusedHostContactDeleted =
|
|||||||
<### [ "bob_1 (Bob): contact is connected",
|
<### [ "bob_1 (Bob): contact is connected",
|
||||||
"contact bob_1 is merged into bob",
|
"contact bob_1 is merged into bob",
|
||||||
"use @bob <message> to send messages",
|
"use @bob <message> to send messages",
|
||||||
EndsWith "invited to group #club via your group link",
|
StartsWith "invitation to join the group #club sent to bob",
|
||||||
EndsWith "joined the group"
|
EndsWith "joined the group"
|
||||||
],
|
],
|
||||||
bob
|
bob
|
||||||
@ -1936,7 +1936,7 @@ testGroupLinkIncognitoUnusedHostContactsDeleted =
|
|||||||
concurrentlyN_
|
concurrentlyN_
|
||||||
[ do
|
[ do
|
||||||
alice <## (bobIncognito <> ": contact is connected")
|
alice <## (bobIncognito <> ": contact is connected")
|
||||||
alice <## (bobIncognito <> " invited to group #" <> group <> " via your group link")
|
alice <## ("invitation to join the group #" <> group <> " sent to " <> bobIncognito)
|
||||||
alice <## ("#" <> group <> ": " <> bobIncognito <> " joined the group"),
|
alice <## ("#" <> group <> ": " <> bobIncognito <> " joined the group"),
|
||||||
do
|
do
|
||||||
bob <## (bobsAliceContact <> " (Alice): contact is connected, your incognito profile for this contact is " <> bobIncognito)
|
bob <## (bobsAliceContact <> " (Alice): contact is connected, your incognito profile for this contact is " <> bobIncognito)
|
||||||
@ -1973,7 +1973,7 @@ testGroupLinkMemberRole =
|
|||||||
concurrentlyN_
|
concurrentlyN_
|
||||||
[ do
|
[ do
|
||||||
alice <## "bob (Bob): contact is connected"
|
alice <## "bob (Bob): contact is connected"
|
||||||
alice <## "bob invited to group #team via your group link"
|
alice <## "invitation to join the group #team sent to bob"
|
||||||
alice <## "#team: bob joined the group",
|
alice <## "#team: bob joined the group",
|
||||||
do
|
do
|
||||||
bob <## "alice (Alice): contact is connected"
|
bob <## "alice (Alice): contact is connected"
|
||||||
@ -1986,12 +1986,11 @@ testGroupLinkMemberRole =
|
|||||||
cath ##> ("/c " <> gLink)
|
cath ##> ("/c " <> gLink)
|
||||||
cath <## "connection request sent!"
|
cath <## "connection request sent!"
|
||||||
alice <## "cath (Catherine): accepting request to join group #team..."
|
alice <## "cath (Catherine): accepting request to join group #team..."
|
||||||
-- if contact existed it is merged
|
|
||||||
concurrentlyN_
|
concurrentlyN_
|
||||||
[ alice
|
[ alice
|
||||||
<### [ "cath (Catherine): contact is connected",
|
<### [ "cath (Catherine): contact is connected",
|
||||||
EndsWith "invited to group #team via your group link",
|
"invitation to join the group #team sent to cath",
|
||||||
EndsWith "joined the group"
|
"#team: cath joined the group"
|
||||||
],
|
],
|
||||||
cath
|
cath
|
||||||
<### [ "alice (Alice): contact is connected",
|
<### [ "alice (Alice): contact is connected",
|
||||||
@ -2041,7 +2040,7 @@ testGroupLinkLeaveDelete =
|
|||||||
<### [ "bob_1 (Bob): contact is connected",
|
<### [ "bob_1 (Bob): contact is connected",
|
||||||
"contact bob_1 is merged into bob",
|
"contact bob_1 is merged into bob",
|
||||||
"use @bob <message> to send messages",
|
"use @bob <message> to send messages",
|
||||||
EndsWith "invited to group #team via your group link",
|
StartsWith "invitation to join the group #team sent to bob",
|
||||||
EndsWith "joined the group"
|
EndsWith "joined the group"
|
||||||
],
|
],
|
||||||
bob
|
bob
|
||||||
@ -2057,7 +2056,7 @@ testGroupLinkLeaveDelete =
|
|||||||
concurrentlyN_
|
concurrentlyN_
|
||||||
[ alice
|
[ alice
|
||||||
<### [ "cath (Catherine): contact is connected",
|
<### [ "cath (Catherine): contact is connected",
|
||||||
"cath invited to group #team via your group link",
|
"invitation to join the group #team sent to cath",
|
||||||
"#team: cath joined the group"
|
"#team: cath joined the group"
|
||||||
],
|
],
|
||||||
cath
|
cath
|
||||||
|
@ -267,7 +267,11 @@ cc <##.. ls = do
|
|||||||
unless prefix $ print ("expected to start from one of: " <> show ls, ", got: " <> l)
|
unless prefix $ print ("expected to start from one of: " <> show ls, ", got: " <> l)
|
||||||
prefix `shouldBe` True
|
prefix `shouldBe` True
|
||||||
|
|
||||||
data ConsoleResponse = ConsoleString String | WithTime String | EndsWith String
|
data ConsoleResponse
|
||||||
|
= ConsoleString String
|
||||||
|
| WithTime String
|
||||||
|
| EndsWith String
|
||||||
|
| StartsWith String
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
||||||
instance IsString ConsoleResponse where fromString = ConsoleString
|
instance IsString ConsoleResponse where fromString = ConsoleString
|
||||||
@ -287,6 +291,7 @@ getInAnyOrder f cc ls = do
|
|||||||
ConsoleString s -> l == s
|
ConsoleString s -> l == s
|
||||||
WithTime s -> dropTime_ l == Just s
|
WithTime s -> dropTime_ l == Just s
|
||||||
EndsWith s -> s `isSuffixOf` l
|
EndsWith s -> s `isSuffixOf` l
|
||||||
|
StartsWith s -> s `isPrefixOf` l
|
||||||
|
|
||||||
(<###) :: HasCallStack => TestCC -> [ConsoleResponse] -> Expectation
|
(<###) :: HasCallStack => TestCC -> [ConsoleResponse] -> Expectation
|
||||||
(<###) = getInAnyOrder id
|
(<###) = getInAnyOrder id
|
||||||
|
Loading…
Reference in New Issue
Block a user