mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-06-07 00:12:20 +00:00
core: backward compatible JSON decoding (#6322)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -164,7 +164,7 @@ getNextDeliveryTasks db gInfo task =
|
||||
MessageDeliveryTask {jobScope, senderGMId} = task
|
||||
getTaskIds :: IO [Int64]
|
||||
getTaskIds
|
||||
| useRelays =
|
||||
| isTrue useRelays =
|
||||
map fromOnly
|
||||
<$> DB.query
|
||||
db
|
||||
|
||||
@@ -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 = "",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user