Adds announcement group change decryption

This commit is contained in:
Josh Perez 2021-07-21 13:58:39 -04:00 committed by GitHub
parent 830c8dd004
commit 8bcf3addc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3897,7 +3897,7 @@ function extractDiffs({
// announcementsOnly // announcementsOnly
if (old.announcementsOnly !== current.announcementsOnly) { if (Boolean(old.announcementsOnly) !== Boolean(current.announcementsOnly)) {
details.push({ details.push({
type: 'announcements-only', type: 'announcements-only',
announcementsOnly: Boolean(current.announcementsOnly), announcementsOnly: Boolean(current.announcementsOnly),
@ -4525,6 +4525,11 @@ async function applyGroupChange({
} }
} }
if (actions.modifyAnnouncementsOnly) {
const { announcementsOnly } = actions.modifyAnnouncementsOnly;
result.announcementsOnly = announcementsOnly;
}
if (ourConversationId) { if (ourConversationId) {
result.left = !members[ourConversationId]; result.left = !members[ourConversationId];
} }
@ -4810,6 +4815,9 @@ async function applyGroupState({
result.description = undefined; result.description = undefined;
} }
// announcementsOnly
result.announcementsOnly = groupState.announcementsOnly;
return { return {
newAttributes: result, newAttributes: result,
newProfileKeys, newProfileKeys,
@ -4916,6 +4924,9 @@ type DecryptedGroupChangeActions = {
modifyDescription?: { modifyDescription?: {
descriptionBytes?: Proto.GroupAttributeBlob; descriptionBytes?: Proto.GroupAttributeBlob;
}; };
modifyAnnouncementsOnly?: {
announcementsOnly: boolean;
};
} & Pick< } & Pick<
Proto.GroupChange.IActions, Proto.GroupChange.IActions,
| 'modifyAttributesAccess' | 'modifyAttributesAccess'
@ -5433,6 +5444,14 @@ function decryptGroupChange(
} }
} }
// modifyAnnouncementsOnly
if (actions.modifyAnnouncementsOnly) {
const { announcementsOnly } = actions.modifyAnnouncementsOnly;
result.modifyAnnouncementsOnly = {
announcementsOnly: Boolean(announcementsOnly),
};
}
return result; return result;
} }
@ -5490,6 +5509,7 @@ type DecryptedGroupState = {
inviteLinkPassword?: string; inviteLinkPassword?: string;
descriptionBytes?: Proto.GroupAttributeBlob; descriptionBytes?: Proto.GroupAttributeBlob;
avatar?: string; avatar?: string;
announcementsOnly?: boolean;
}; };
function decryptGroupState( function decryptGroupState(
@ -5621,6 +5641,10 @@ function decryptGroupState(
} }
} }
// announcementsOnly
const { announcementsOnly } = groupState;
result.announcementsOnly = Boolean(announcementsOnly);
result.avatar = dropNull(groupState.avatar); result.avatar = dropNull(groupState.avatar);
return result; return result;