Prefer remote value for profile sharing during storage sync.

This commit is contained in:
Greyson Parrelli 2020-09-24 12:41:31 -04:00
parent 9cf7eec247
commit 864a1d5e93
2 changed files with 3 additions and 3 deletions

View file

@ -84,7 +84,7 @@ class ContactConflictMerger implements StorageSyncHelper.ConflictMerger<SignalCo
IdentityState identityState = remote.getIdentityState();
byte[] identityKey = remote.getIdentityKey().or(local.getIdentityKey()).orNull();
boolean blocked = remote.isBlocked();
boolean profileSharing = remote.isProfileSharingEnabled() || local.isProfileSharingEnabled();
boolean profileSharing = remote.isProfileSharingEnabled();
boolean archived = remote.isArchived();
boolean matchesRemote = doParamsMatch(remote, unknownFields, address, givenName, familyName, profileKey, username, identityState, identityKey, blocked, profileSharing, archived);
boolean matchesLocal = doParamsMatch(local, unknownFields, address, givenName, familyName, profileKey, username, identityState, identityKey, blocked, profileSharing, archived);

View file

@ -44,7 +44,7 @@ public class ContactConflictMergerTest {
}
@Test
public void merge_alwaysPreferRemote_exceptProfileSharingIsEitherOr() {
public void merge_alwaysPreferRemote() {
SignalContactRecord remote = new SignalContactRecord.Builder(byteArray(1), new SignalServiceAddress(UUID_A, E164_A))
.setBlocked(true)
.setIdentityKey(byteArray(2))
@ -79,7 +79,7 @@ public class ContactConflictMergerTest {
assertEquals("AFirst", merged.getGivenName().get());
assertEquals("ALast", merged.getFamilyName().get());
assertEquals("username A", merged.getUsername().get());
assertTrue(merged.isProfileSharingEnabled());
assertFalse(merged.isProfileSharingEnabled());
assertFalse(merged.isArchived());
}