remove spurious comments

This commit is contained in:
Evgeny @ SimpleX Chat committed 2026-06-27 14:59:45 +00:00
1 parent fbcdd1f21f
commit a990a7f7d4
9 files changed
+3 -86

No files matched your search

-1
View File
@@ -138,7 +138,6 @@ getConnectionEntity db cxt user@User {userId, userContactId} agentConnId = do
gm <-
ExceptT $
firstRow (toGroupAndMember currentTs c) (SEInternalError "referenced group member not found") $
-- Mirrors Store/Shared.hs groupInfoQueryFields — keep column lists in sync.
DB.query
db
[sql|
-9
View File
@@ -560,11 +560,6 @@ deleteUnusedProfile_ db userId profileId =
:. (userId, profileId, userId, profileId, profileId)
)
-- | Updates the contact profile, writing the peer's contact_domain claim onto
-- the profile. Resets contact_domain_verification to NULL only when the claimed
-- name changes (the prior verification was tied to the prior claim); an XInfo
-- with the same name keeps the existing status, exactly as a badge does. No
-- conflict clearing (no UNIQUE index).
updateContactProfile :: DB.Connection -> StoreCxt -> User -> Contact -> Profile -> ExceptT StoreError IO Contact
updateContactProfile db cxt user@User {userId} c p' = do
currentTs <- liftIO getCurrentTime
@@ -577,8 +572,6 @@ updateContactProfile db cxt user@User {userId} c p' = do
Profile {displayName = newName, contactDomain, preferences} = p'
mergedPreferences = contactUserPreferences user userPreferences preferences $ contactConnIncognito c
claimChanged = prevDomain /= (unStrJSON <$> contactDomain)
-- a name proof is never sent in a profile update (XInfo) from the peer (we never make or accept a PHTest name proof):
-- keep the stored proof when the name is unchanged, drop it when the name changes (then it's unverified)
p'' = (p' :: Profile) {contactDomainProof = if claimChanged then Nothing else prevProof}
clearVerificationIfClaimChanged =
when claimChanged $
@@ -595,8 +588,6 @@ updateContactProfile db cxt user@User {userId} c p' = do
clearVerificationIfClaimChanged
pure $ Right c {localDisplayName = ldn, profile, mergedPreferences}
-- | Records the local 3-state verification status of the peer's name claim.
-- Cleared back to NULL by updateContactProfile when the claim changes.
setContactDomainVerified :: DB.Connection -> User -> ContactId -> Bool -> IO ()
setContactDomainVerified db User {userId} contactId verified =
DB.execute
-9
View File
@@ -1080,9 +1080,6 @@ getGroupInfoBySimplexName db cxt user ni =
Nothing -> pure Nothing
Just gId -> Just <$> getGroupInfo db cxt user gId
-- | Channel lookup by the verified name (group_profiles.group_domain joined with
-- groups.group_domain_verification = 1); on a miss the caller falls through to
-- resolve-and-connect.
getGroupIdBySimplexName :: DB.Connection -> User -> SimplexNameInfo -> IO (Maybe GroupId)
getGroupIdBySimplexName db User {userId} ni =
maybeFirstRow fromOnly $
@@ -2645,9 +2642,6 @@ createMemberConnection_ :: DB.Connection -> UserId -> Int64 -> ConnId -> Version
createMemberConnection_ db userId groupMemberId agentConnId chatV peerChatVRange viaContact connLevel currentTs subMode =
createConnection_ db userId ConnMember (Just groupMemberId) agentConnId ConnNew chatV peerChatVRange viaContact Nothing Nothing connLevel currentTs subMode PQSupportOff
-- | Updates the group profile, writing the channel name onto group_profiles
-- (group_domain, via the public-access columns). Resets group_domain_verification
-- to NULL only when the name changes. No conflict clearing (no UNIQUE index).
updateGroupProfile :: DB.Connection -> User -> GroupInfo -> GroupProfile -> ExceptT StoreError IO GroupInfo
updateGroupProfile db user@User {userId} g@GroupInfo {groupId, localDisplayName, groupProfile = GroupProfile {displayName, publicGroup = oldPublicGroup}} p'@GroupProfile {displayName = newName, fullName, shortDescr, description, image, publicGroup, groupPreferences, memberAdmission}
| displayName == newName = liftIO $ do
@@ -2667,8 +2661,6 @@ updateGroupProfile db user@User {userId} g@GroupInfo {groupId, localDisplayName,
groupClaim pg = unStrJSON <$> (pg >>= publicGroupAccess >>= groupDomain)
claimChanged = groupClaim oldPublicGroup /= groupClaim publicGroup
g' = if claimChanged then (g :: GroupInfo) {groupDomainVerification = Nothing} else g
-- Reset the verification when the channel name changes; prior verification
-- was bound to the prior name.
clearVerificationIfClaimChanged =
when claimChanged $
DB.execute db "UPDATE groups SET group_domain_verification = NULL WHERE user_id = ? AND group_id = ?" (userId, groupId)
@@ -2698,7 +2690,6 @@ updateGroupProfile db user@User {userId} g@GroupInfo {groupId, localDisplayName,
(ldn, currentTs, userId, groupId)
safeDeleteLDN db user localDisplayName
-- | Records the local 3-state verification status of the channel name.
setGroupDomainVerified :: DB.Connection -> User -> GroupId -> Bool -> IO ()
setGroupDomainVerified db User {userId} groupId verified =
DB.execute
-7
View File
@@ -356,9 +356,6 @@ updateUserProfile db user p'
userMemberProfileChanged = newName /= displayName || fn' /= fullName || d' /= shortDescr || img' /= image
User {userId, userContactId, localDisplayName, profile = LocalProfile {profileId, displayName, fullName, shortDescr, image, localBadge, localAlias}, userMemberProfileUpdatedAt} = user
Profile {displayName = newName, fullName = fn', shortDescr = d', image = img', preferences} = p'
-- contact_profiles.contact_domain (the broadcast name) is set out of band via the
-- set-name API, not through a regular profile edit; updateUserProfileFields_'
-- deliberately does not write it.
fullPreferences = fullPreferences' preferences
-- own profile field update; leaves the badge columns alone (the credential is owned by setUserBadge/addUserBadge)
@@ -389,8 +386,6 @@ setUserBadge db user@User {userId, profile = p@LocalProfile {profileId}} localBa
DB.execute db "UPDATE users SET user_member_profile_updated_at = ? WHERE user_id = ?" (ts, userId)
pure (user :: User) {profile = p {localBadge}, userMemberProfileUpdatedAt = Just ts}
-- set the user's own broadcast name (contact_profiles.contact_domain) out of band (see updateUserProfileFields_').
-- The verifiable proof is not stored here; it is generated fresh when the address link data is re-saved.
setUserSimplexName :: DB.Connection -> User -> Maybe SimplexNameInfo -> IO User
setUserSimplexName db user@User {userId, profile = p@LocalProfile {profileId}} name_ = do
ts <- getCurrentTime
@@ -528,7 +523,6 @@ getUserAddress db User {userId} =
ExceptT . firstRow toUserContactLink SEUserContactLinkNotFound $
DB.query db (userContactLinkQuery <> " WHERE user_id = ? AND local_display_name = '' AND group_id IS NULL") (Only userId)
-- the contact-address owner signing key, captured at address creation, used to sign the user's name proofs
getUserAddressSigKey :: DB.Connection -> User -> IO (Maybe C.PrivateKeyEd25519)
getUserAddressSigKey db User {userId} =
fmap join . maybeFirstRow fromOnly $
@@ -858,7 +852,6 @@ toServerOperator ((operatorId, operatorTag, tradeName, legalName, domains, BI en
}
where
serverRolesSMP (BI storage, BI proxy, BI names) = ServerRoles {storage, proxy, names}
-- XFTP has no names role; the column is SMP-only.
serverRolesXFTP (BI storage, BI proxy) = ServerRoles {storage, proxy, names = False}
getOperatorConditions_ :: DB.Connection -> ServerOperator -> UsageConditions -> Maybe UsageConditions -> UTCTime -> IO ConditionsAcceptance
-5
View File
@@ -272,7 +272,6 @@ toMaybeConnection cxt ((Just connId, Just agentConnId, Just connLevel, viaContac
Just $ toConnection cxt ((connId, agentConnId, connLevel, viaContact, viaUserContactLink, viaGroupLink, groupLinkId, xContactId) :. (customUserProfileId, connStatus, connType, contactConnInitiated, localAlias) :. (contactId, groupMemberId, userContactLinkId) :. (createdAt, code_, verifiedAt_, pqSupport, pqEncryption, pqSndEnabled_, pqRcvEnabled_, authErrCounter, quotaErrCounter, connChatVersion, minVer, maxVer))
toMaybeConnection _ _ = Nothing
-- | Creates a new connection row.
createConnection_ :: DB.Connection -> UserId -> ConnType -> Maybe Int64 -> ConnId -> ConnStatus -> VersionChat -> VersionRangeChat -> Maybe ContactId -> Maybe Int64 -> Maybe ProfileId -> Int -> UTCTime -> SubscriptionMode -> PQSupport -> IO Connection
createConnection_ db userId connType entityId acId connStatus connChatVersion peerChatVRange@(VersionRange minV maxV) viaContact viaUserContactLink customUserProfileId connLevel currentTs subMode pqSup = do
viaLinkGroupId :: Maybe Int64 <- fmap join . forM viaUserContactLink $ \ucLinkId ->
@@ -416,7 +415,6 @@ createContact db cxt user profile = do
currentTs <- liftIO getCurrentTime
void $ createContact_ db cxt user profile emptyChatPrefs Nothing "" currentTs
-- | Inserts a new contact and its profile, returning the new contactId.
createContact_ :: DB.Connection -> StoreCxt -> User -> Profile -> Preferences -> Maybe (ACreatedConnLink, Maybe SharedMsgId) -> LocalAlias -> UTCTime -> ExceptT StoreError IO ContactId
createContact_ db cxt User {userId} Profile {displayName, fullName, shortDescr, image, contactLink, contactDomain, contactDomainProof, peerType, badge, preferences} ctUserPreferences prepared localAlias currentTs =
ExceptT . withLocalDisplayName db userId displayName $ \ldn -> do
@@ -495,8 +493,6 @@ type ContactRow' = (ProfileId, ContactName, ContactName, Text, Maybe Text, Maybe
type ContactRow = Only ContactId :. ContactRow'
-- cp.contact_domain -> LocalProfile.contactDomain (peer's broadcast name claim);
-- cp.contact_domain_verification -> LocalProfile.contactDomainVerification
toContact :: UTCTime -> StoreCxt -> User -> [ChatTagId] -> ContactRow :. MaybeConnectionRow -> Contact
toContact now cxt user chatTags ((Only contactId :. (profileId, localDisplayName, displayName, fullName, shortDescr, image, contactLink, peerType, localAlias, BI contactUsed, contactStatus) :. (enableNtfs_, sendRcpts, BI favorite, preferences, userPreferences, createdAt, updatedAt, chatTs) :. preparedContactRow :. (contactRequestId, contactGroupMemberId, BI contactGrpInvSent) :. groupDirectInvRow :. (uiThemes, BI chatDeleted, customData, chatItemTTL) :. badgeRow :. (cpContactDomain, cpContactDomainVerification, cpContactDomainProof)) :. connRow) =
let profile = LocalProfile {profileId, displayName, fullName, shortDescr, image, contactLink, contactDomain = cpContactDomain, contactDomainVerification = unBI <$> cpContactDomainVerification, contactDomainProof = cpContactDomainProof, peerType, localBadge = rowToBadge now badgeRow, preferences, localAlias}
@@ -784,7 +780,6 @@ toBusinessChatInfo _ = Nothing
groupInfoQuery :: Query
groupInfoQuery = groupInfoQueryFields <> " " <> groupInfoQueryFrom
-- Mirrored in Store/Connections.hs getGroupAndMember_ — keep column lists in sync.
groupInfoQueryFields :: Query
groupInfoQueryFields =
[sql|