core: backward compatible JSON decoding (#6322)

This commit is contained in:
Evgeny
2025-09-30 23:05:12 +01:00
committed by GitHub
parent a1734ce140
commit eca2937be1
5 changed files with 11 additions and 7 deletions
+1 -1
View File
@@ -3216,7 +3216,7 @@ runDeliveryJobWorker a deliveryKey Worker {doWork} = do
MessageDeliveryJob {jobId, jobScope, singleSenderGMId_, body, cursorGMId_ = startingCursor} = job
sendBodyToMembers :: CM ()
sendBodyToMembers
| useRelays gInfo = -- channel
| isTrue (useRelays gInfo) = -- channel
case jobScope of
-- there's no member review in channels, so job spec includePending is ignored
DJSGroup {} -> sendLoop startingCursor
+1 -1
View File
@@ -164,7 +164,7 @@ getNextDeliveryTasks db gInfo task =
MessageDeliveryTask {jobScope, senderGMId} = task
getTaskIds :: IO [Int64]
getTaskIds
| useRelays =
| isTrue useRelays =
map fromOnly
<$> DB.query
db
+2 -2
View File
@@ -339,7 +339,7 @@ createNewGroup db vr gVar user@User {userId} groupProfile incognitoProfile = Exc
pure
GroupInfo
{ groupId,
useRelays = False,
useRelays = BoolDef False,
localDisplayName = ldn,
groupProfile,
localAlias = "",
@@ -414,7 +414,7 @@ createGroupInvitation db vr user@User {userId} contact@Contact {contactId, activ
pure
( GroupInfo
{ groupId,
useRelays = False,
useRelays = BoolDef False,
localDisplayName,
groupProfile,
localAlias = "",
+1 -1
View File
@@ -669,7 +669,7 @@ toGroupInfo vr userContactId chatTags ((groupId, localDisplayName, displayName,
businessChat = toBusinessChatInfo businessRow
preparedGroup = toPreparedGroup preparedGroupRow
groupSummary = GroupSummary {currentMembers}
in GroupInfo {groupId, useRelays = False, localDisplayName, groupProfile, localAlias, businessChat, fullGroupPreferences, membership, chatSettings, createdAt, updatedAt, chatTs, userMemberProfileSentAt, preparedGroup, chatTags, chatItemTTL, uiThemes, groupSummary, customData, membersRequireAttention, viaGroupLinkUri}
in GroupInfo {groupId, useRelays = BoolDef False, localDisplayName, groupProfile, localAlias, businessChat, fullGroupPreferences, membership, chatSettings, createdAt, updatedAt, chatTs, userMemberProfileSentAt, preparedGroup, chatTags, chatItemTTL, uiThemes, groupSummary, customData, membersRequireAttention, viaGroupLinkUri}
toPreparedGroup :: PreparedGroupRow -> Maybe PreparedGroup
toPreparedGroup = \case
+6 -2
View File
@@ -446,7 +446,7 @@ type GroupId = Int64
data GroupInfo = GroupInfo
{ groupId :: GroupId,
useRelays :: Bool,
useRelays :: BoolDef,
localDisplayName :: GroupName,
groupProfile :: GroupProfile,
localAlias :: Text,
@@ -2030,7 +2030,11 @@ $(JQ.deriveJSON defaultJSON ''BusinessChatInfo)
$(JQ.deriveJSON defaultJSON ''PreparedGroup)
$(JQ.deriveJSON defaultJSON ''GroupSummary)
$(JQ.deriveToJSON defaultJSON ''GroupSummary)
instance FromJSON GroupSummary where
parseJSON = $(JQ.mkParseJSON defaultJSON ''GroupSummary)
omittedField = Just GroupSummary {currentMembers = 0}
$(JQ.deriveJSON defaultJSON ''GroupInfo)