Fix group state decoding for default values
This commit is contained in:
parent
f8b936f258
commit
046a3c4849
1 changed files with 11 additions and 6 deletions
17
ts/groups.ts
17
ts/groups.ts
|
@ -6603,9 +6603,13 @@ function decryptGroupState(
|
|||
const { accessControl } = groupState;
|
||||
strictAssert(accessControl, 'No accessControl field found');
|
||||
|
||||
const attributes = dropNull(accessControl.attributes);
|
||||
const members = dropNull(accessControl.members);
|
||||
const addFromInviteLink = dropNull(accessControl.addFromInviteLink);
|
||||
const attributes =
|
||||
accessControl.attributes ?? Proto.AccessControl.AccessRequired.UNKNOWN;
|
||||
const members =
|
||||
accessControl.members ?? Proto.AccessControl.AccessRequired.UNKNOWN;
|
||||
const addFromInviteLink =
|
||||
accessControl.addFromInviteLink ??
|
||||
Proto.AccessControl.AccessRequired.UNKNOWN;
|
||||
|
||||
strictAssert(
|
||||
isValidAccess(attributes),
|
||||
|
@ -6628,11 +6632,12 @@ function decryptGroupState(
|
|||
}
|
||||
|
||||
// version
|
||||
const version = groupState.version ?? 0;
|
||||
strictAssert(
|
||||
isNumber(groupState.version),
|
||||
`decryptGroupState: Expected version to be a number; it was ${groupState.version}`
|
||||
isNumber(version),
|
||||
`decryptGroupState: Expected version to be a number or null; it was ${groupState.version}`
|
||||
);
|
||||
result.version = groupState.version;
|
||||
result.version = version;
|
||||
|
||||
// members
|
||||
if (groupState.members) {
|
||||
|
|
Loading…
Reference in a new issue