Ensure GV1->GV2 migrations work via group links.

This commit is contained in:
Greyson Parrelli 2020-12-08 13:21:21 -05:00
parent 9cd1a12b6a
commit 944a180b68

View file

@ -763,9 +763,17 @@ final class GroupManagerV2 {
alreadyAMember = true; alreadyAMember = true;
} }
Optional<GroupDatabase.GroupRecord> unmigratedV1Group = groupDatabase.getGroupV1ByExpectedV2(groupId);
if (unmigratedV1Group.isPresent()) {
Log.i(TAG, "Group link was for a migrated V1 group we know about! Migrating it and using that as the base.");
GroupsV1MigrationUtil.performLocalMigration(context, unmigratedV1Group.get().getId().requireV1());
}
DecryptedGroup decryptedGroup = createPlaceholderGroup(joinInfo, requestToJoin); DecryptedGroup decryptedGroup = createPlaceholderGroup(joinInfo, requestToJoin);
Optional<GroupDatabase.GroupRecord> group = groupDatabase.getGroup(groupId); Optional<GroupDatabase.GroupRecord> group = groupDatabase.getGroup(groupId);
if (group.isPresent()) { if (group.isPresent()) {
Log.i(TAG, "Group already present locally"); Log.i(TAG, "Group already present locally");