comments, schema

This commit is contained in:
spaced4ndy 2025-06-26 13:13:00 +04:00
parent 32272b32d8
commit 9382ccd37a
4 changed files with 10 additions and 11 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)