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;
|
const { accessControl } = groupState;
|
||||||
strictAssert(accessControl, 'No accessControl field found');
|
strictAssert(accessControl, 'No accessControl field found');
|
||||||
|
|
||||||
const attributes = dropNull(accessControl.attributes);
|
const attributes =
|
||||||
const members = dropNull(accessControl.members);
|
accessControl.attributes ?? Proto.AccessControl.AccessRequired.UNKNOWN;
|
||||||
const addFromInviteLink = dropNull(accessControl.addFromInviteLink);
|
const members =
|
||||||
|
accessControl.members ?? Proto.AccessControl.AccessRequired.UNKNOWN;
|
||||||
|
const addFromInviteLink =
|
||||||
|
accessControl.addFromInviteLink ??
|
||||||
|
Proto.AccessControl.AccessRequired.UNKNOWN;
|
||||||
|
|
||||||
strictAssert(
|
strictAssert(
|
||||||
isValidAccess(attributes),
|
isValidAccess(attributes),
|
||||||
|
@ -6628,11 +6632,12 @@ function decryptGroupState(
|
||||||
}
|
}
|
||||||
|
|
||||||
// version
|
// version
|
||||||
|
const version = groupState.version ?? 0;
|
||||||
strictAssert(
|
strictAssert(
|
||||||
isNumber(groupState.version),
|
isNumber(version),
|
||||||
`decryptGroupState: Expected version to be a number; it was ${groupState.version}`
|
`decryptGroupState: Expected version to be a number or null; it was ${groupState.version}`
|
||||||
);
|
);
|
||||||
result.version = groupState.version;
|
result.version = version;
|
||||||
|
|
||||||
// members
|
// members
|
||||||
if (groupState.members) {
|
if (groupState.members) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue