parent
5e8d74bc11
commit
fc9b8f43dd
1 changed files with 15 additions and 4 deletions
|
@ -447,11 +447,20 @@ private static final String[] GROUP_PROJECTION = {
|
||||||
|
|
||||||
public GroupId.V2 create(@NonNull GroupMasterKey groupMasterKey,
|
public GroupId.V2 create(@NonNull GroupMasterKey groupMasterKey,
|
||||||
@NonNull DecryptedGroup groupState)
|
@NonNull DecryptedGroup groupState)
|
||||||
|
{
|
||||||
|
return create(groupMasterKey, groupState, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupId.V2 create(@NonNull GroupMasterKey groupMasterKey,
|
||||||
|
@NonNull DecryptedGroup groupState,
|
||||||
|
boolean force)
|
||||||
{
|
{
|
||||||
GroupId.V2 groupId = GroupId.v2(groupMasterKey);
|
GroupId.V2 groupId = GroupId.v2(groupMasterKey);
|
||||||
|
|
||||||
if (getGroupV1ByExpectedV2(groupId).isPresent()) {
|
if (!force && getGroupV1ByExpectedV2(groupId).isPresent()) {
|
||||||
throw new MissedGroupMigrationInsertException(groupId);
|
throw new MissedGroupMigrationInsertException(groupId);
|
||||||
|
} else if (force) {
|
||||||
|
Log.w(TAG, "Forcing the creation of a group even though we already have a V1 ID!");
|
||||||
}
|
}
|
||||||
|
|
||||||
create(groupId, groupState.getTitle(), Collections.emptyList(), null, null, groupMasterKey, groupState);
|
create(groupId, groupState.getTitle(), Collections.emptyList(), null, null, groupMasterKey, groupState);
|
||||||
|
@ -484,9 +493,11 @@ private static final String[] GROUP_PROJECTION = {
|
||||||
|
|
||||||
if (updated < 1) {
|
if (updated < 1) {
|
||||||
Log.w(TAG, "No group entry. Creating restore placeholder for " + groupId);
|
Log.w(TAG, "No group entry. Creating restore placeholder for " + groupId);
|
||||||
create(groupMasterKey, DecryptedGroup.newBuilder()
|
create(groupMasterKey,
|
||||||
.setRevision(GroupsV2StateProcessor.RESTORE_PLACEHOLDER_REVISION)
|
DecryptedGroup.newBuilder()
|
||||||
.build());
|
.setRevision(GroupsV2StateProcessor.RESTORE_PLACEHOLDER_REVISION)
|
||||||
|
.build(),
|
||||||
|
true);
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "Had a group entry, but it was missing a master key. Updated.");
|
Log.w(TAG, "Had a group entry, but it was missing a master key. Updated.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue