Fix behavior when reading a v1 group from storage that has already been migrated locally

Fixes #888
This commit is contained in:
AsamK 2022-02-10 15:40:04 +01:00
parent 8966535efe
commit fd8ba66509

View file

@ -129,18 +129,18 @@ public class StorageHelper {
final var groupV1Record = record.getGroupV1().get(); final var groupV1Record = record.getGroupV1().get();
final var groupIdV1 = GroupId.v1(groupV1Record.getGroupId()); final var groupIdV1 = GroupId.v1(groupV1Record.getGroupId());
final var group = account.getGroupStore().getGroup(groupIdV1); var group = account.getGroupStore().getGroup(groupIdV1);
if (group == null) { if (group == null) {
try { try {
context.getGroupHelper().sendGroupInfoRequest(groupIdV1, account.getSelfRecipientId()); context.getGroupHelper().sendGroupInfoRequest(groupIdV1, account.getSelfRecipientId());
} catch (Throwable e) { } catch (Throwable e) {
logger.warn("Failed to send group request", e); logger.warn("Failed to send group request", e);
} }
group = account.getGroupStore().getOrCreateGroupV1(groupIdV1);
} }
final var groupV1 = account.getGroupStore().getOrCreateGroupV1(groupIdV1); if (group != null && group.isBlocked() != groupV1Record.isBlocked()) {
if (groupV1.isBlocked() != groupV1Record.isBlocked()) { group.setBlocked(groupV1Record.isBlocked());
groupV1.setBlocked(groupV1Record.isBlocked()); account.getGroupStore().updateGroup(group);
account.getGroupStore().updateGroup(groupV1);
} }
} }