From 9382ccd37a7860f623f78c78a68c2d00d91e2ce8 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Thu, 26 Jun 2025 13:13:00 +0400 Subject: [PATCH] comments, schema --- src/Simplex/Chat/Library/Commands.hs | 4 ++-- src/Simplex/Chat/Library/Internal.hs | 4 ++-- src/Simplex/Chat/Library/Subscriber.hs | 12 ++++++------ .../Chat/Store/SQLite/Migrations/chat_schema.sql | 1 - 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Simplex/Chat/Library/Commands.hs b/src/Simplex/Chat/Library/Commands.hs index eef984833c..fb85dec0a7 100644 --- a/src/Simplex/Chat/Library/Commands.hs +++ b/src/Simplex/Chat/Library/Commands.hs @@ -1157,7 +1157,7 @@ processChatCommand' vr = \case when (shortLinkDataSet && incognito) $ throwCmdError "incognito not allowed for address with short link data" withUserContactLock "acceptContact" uclId $ do cReq <- withFastStore $ \db -> getContactRequest db user connReqId - -- TODO accept async, move to continuation on JOIN? + -- TODO [short links] accept async, move to continuation on JOIN? (ct, conn@Connection {connId}, sqSecured) <- acceptContactRequest user cReq incognito let contactUsed = isNothing gLinkInfo_ ct' <- withStore' $ \db -> do @@ -1808,7 +1808,7 @@ processChatCommand' vr = \case pure $ CRStartedConnectionToContact user ct' customUserProfile cr -> pure cr Just PreparedContact {connLinkToConnect = ACCL SCMContact ccLink, welcomeSharedMsgId} -> do - -- TODO reuse welcomeSharedMsgId + -- TODO [short links] reuse welcomeSharedMsgId msg_ <- forM msgContent_ $ \mc -> (,mc) <$> getSharedMsgId connectViaContact user incognito ccLink welcomeSharedMsgId msg_ (Just $ ACCGContact contactId) >>= \case CRSentInvitation {customUserProfile} -> do diff --git a/src/Simplex/Chat/Library/Internal.hs b/src/Simplex/Chat/Library/Internal.hs index b58ecedf40..d89e001771 100644 --- a/src/Simplex/Chat/Library/Internal.hs +++ b/src/Simplex/Chat/Library/Internal.hs @@ -998,7 +998,7 @@ acceptBusinessJoinRequestAsync UserContactRequest {agentInvitationId = AgentInvId cReqInvId, cReqChatVRange, xContactId} = do vr <- chatVersionRange let userProfile@Profile {displayName, preferences} = profileToSendOnAccept user Nothing True - -- TODO how to take groupPreferences from group info? + -- TODO [short links] take groupPreferences from group info groupPreferences = maybe defaultBusinessGroupPrefs businessGroupPrefs preferences msg = XGrpLinkInv $ @@ -1024,7 +1024,7 @@ acceptBusinessJoinRequestAsync -- TODO [short links] move to profileContactRequest? createInternalChatItem user cd (CISndGroupE2EEInfo E2EInfo {pqEnabled = Just PQEncOff}) Nothing createGroupFeatureItems user cd CISndGroupFeature gInfo - -- TODO get updated? (currently not used) + -- TODO [short links] get updated business chat group and member? (currently not used) pure (gInfo, clientMember) businessGroupProfile :: Profile -> GroupPreferences -> GroupProfile diff --git a/src/Simplex/Chat/Library/Subscriber.hs b/src/Simplex/Chat/Library/Subscriber.hs index 7f505c38fe..810af2fe0e 100644 --- a/src/Simplex/Chat/Library/Subscriber.hs +++ b/src/Simplex/Chat/Library/Subscriber.hs @@ -573,7 +573,7 @@ processAgentMessageConn vr user@User {userId} corrId agentConnId agentMessage = lift $ setContactNetworkStatus ct' NSConnected toView $ CEvtContactConnected user ct' (fmap fromLocalProfile incognitoProfile) let createE2EItem = createInternalChatItem user (CDDirectRcv ct') (CIRcvDirectE2EEInfo $ E2EInfo $ Just pqEnc) Nothing - -- TODO get contact request by contactRequestId, check encryption (UserContactRequest.pqSupport)? + -- TODO [short links] get contact request by contactRequestId, check encryption (UserContactRequest.pqSupport)? when (directOrUsed ct') $ case (preparedContact ct', contactRequestId' ct') of (Nothing, Nothing) -> do createE2EItem @@ -1250,10 +1250,10 @@ processAgentMessageConn vr user@User {userId} corrId agentConnId agentMessage = withStore (\db -> createOrUpdateContactRequest db gVar vr user uclId ucl isSimplexTeam invId chatVRange p xContactId_ welcomeMsgId_ requestMsg_ reqPQSup) >>= \case RSAcceptedRequest _ucr re -> case re of REContact ct -> - -- TODO update request msg + -- TODO [short links] update request msg toView $ CEvtContactRequestAlreadyAccepted user ct REBusinessChat gInfo _clientMember -> - -- TODO update request msg + -- TODO [short links] update request msg toView $ CEvtBusinessRequestAlreadyAccepted user gInfo RSCurrentRequest ucr re_ repeatRequest -> case re_ of Nothing -> toView $ CEvtReceivedContactRequest user ucr Nothing @@ -1263,7 +1263,7 @@ processAgentMessageConn vr user@User {userId} corrId agentConnId agentMessage = -- Do not created e2e item on repeat request if repeatRequest then do - -- TODO update request msg + -- TODO [short links] update request msg -- .... acceptOrShow Nothing -- pass item? else do @@ -1305,9 +1305,9 @@ processAgentMessageConn vr user@User {userId} corrId agentConnId agentMessage = forM_ requestMsg_ $ \(sharedMsgId, mc) -> createInternalChatItem user (CDGroupRcv gInfo Nothing clientMember) (CIRcvMsgContent mc) Nothing toView $ CEvtAcceptingBusinessRequest user gInfo - -- ##### Group link join requests ##### + -- ##### Group link join requests (don't create contact requests) ##### Just gli@GroupLinkInfo {groupId, memberRole = gLinkMemRole} -> do - -- TODO deduplicate request by xContactId? + -- TODO [short links] deduplicate request by xContactId? gInfo <- withStore $ \db -> getGroupInfo db vr user groupId acceptMember_ <- asks $ acceptMember . chatHooks . config maybe (pure $ Right (GAAccepted, gLinkMemRole)) (\am -> liftIO $ am gInfo gli p) acceptMember_ >>= \case diff --git a/src/Simplex/Chat/Store/SQLite/Migrations/chat_schema.sql b/src/Simplex/Chat/Store/SQLite/Migrations/chat_schema.sql index dd2ddf0778..78207bc64f 100644 --- a/src/Simplex/Chat/Store/SQLite/Migrations/chat_schema.sql +++ b/src/Simplex/Chat/Store/SQLite/Migrations/chat_schema.sql @@ -357,7 +357,6 @@ CREATE TABLE contact_requests( pq_support INTEGER NOT NULL DEFAULT 0, contact_id INTEGER REFERENCES contacts ON DELETE CASCADE, business_group_id INTEGER REFERENCES groups(group_id) ON DELETE CASCADE, - accepted INTEGER NOT NULL DEFAULT 0, welcome_shared_msg_id BLOB, request_shared_msg_id BLOB, FOREIGN KEY(user_id, local_display_name)