Apply decrypted group change when receiving signed change

This commit is contained in:
AsamK 2020-12-12 11:51:38 +01:00
parent c10910e466
commit 98dee97cc6
2 changed files with 51 additions and 2 deletions

View file

@ -1534,8 +1534,18 @@ public class Manager implements Closeable {
if (groupInfoV2.getGroup() == null
|| groupInfoV2.getGroup().getRevision() < groupContext.getRevision()) {
// TODO check if revision is only 1 behind and a signedGroupChange is available
groupInfoV2.setGroup(getDecryptedGroup(groupSecretParams));
DecryptedGroup group = null;
if (groupContext.hasSignedGroupChange()
&& groupInfoV2.getGroup() != null
&& groupInfoV2.getGroup().getRevision() + 1 == groupContext.getRevision()) {
group = groupHelper.getUpdatedDecryptedGroup(groupInfoV2.getGroup(),
groupContext.getSignedGroupChange(),
groupMasterKey);
}
if (group == null) {
group = getDecryptedGroup(groupSecretParams);
}
groupInfoV2.setGroup(group);
account.getGroupStore().updateGroup(groupInfoV2);
}
}