mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 02:18:08 +01:00
Refactor repeated use of the UserCapabilities constructor
This commit is contained in:
@@ -231,10 +231,6 @@ public class ProfileController {
|
||||
|
||||
Optional<ProfileKeyCredentialResponse> credential = getProfileCredential(credentialRequest, profile, uuid);
|
||||
|
||||
final UserCapabilities userCapabilities = new UserCapabilities(
|
||||
accountProfile.get().isGroupsV2Supported(),
|
||||
accountProfile.get().isGv1MigrationSupported(),
|
||||
accountProfile.get().isSenderKeySupported());
|
||||
return Optional.of(new Profile(name,
|
||||
about,
|
||||
aboutEmoji,
|
||||
@@ -243,7 +239,7 @@ public class ProfileController {
|
||||
accountProfile.get().getIdentityKey(),
|
||||
UnidentifiedAccessChecksum.generateFor(accountProfile.get().getUnidentifiedAccessKey()),
|
||||
accountProfile.get().isUnrestrictedUnidentifiedAccess(),
|
||||
userCapabilities,
|
||||
UserCapabilities.createForAccount(accountProfile.get()),
|
||||
username.orElse(null),
|
||||
null,
|
||||
credential.orElse(null)));
|
||||
@@ -275,10 +271,6 @@ public class ProfileController {
|
||||
throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build());
|
||||
}
|
||||
|
||||
final UserCapabilities userCapabilities = new UserCapabilities(
|
||||
accountProfile.get().isGroupsV2Supported(),
|
||||
accountProfile.get().isGv1MigrationSupported(),
|
||||
accountProfile.get().isSenderKeySupported());
|
||||
return new Profile(accountProfile.get().getProfileName(),
|
||||
null,
|
||||
null,
|
||||
@@ -287,7 +279,7 @@ public class ProfileController {
|
||||
accountProfile.get().getIdentityKey(),
|
||||
UnidentifiedAccessChecksum.generateFor(accountProfile.get().getUnidentifiedAccessKey()),
|
||||
accountProfile.get().isUnrestrictedUnidentifiedAccess(),
|
||||
userCapabilities,
|
||||
UserCapabilities.createForAccount(accountProfile.get()),
|
||||
username,
|
||||
accountProfile.get().getUuid(),
|
||||
null);
|
||||
@@ -354,10 +346,6 @@ public class ProfileController {
|
||||
username = usernamesManager.get(accountProfile.get().getUuid());
|
||||
}
|
||||
|
||||
final UserCapabilities userCapabilities = new UserCapabilities(
|
||||
accountProfile.get().isGroupsV2Supported(),
|
||||
accountProfile.get().isGv1MigrationSupported(),
|
||||
accountProfile.get().isSenderKeySupported());
|
||||
return new Profile(accountProfile.get().getProfileName(),
|
||||
null,
|
||||
null,
|
||||
@@ -366,7 +354,7 @@ public class ProfileController {
|
||||
accountProfile.get().getIdentityKey(),
|
||||
UnidentifiedAccessChecksum.generateFor(accountProfile.get().getUnidentifiedAccessKey()),
|
||||
accountProfile.get().isUnrestrictedUnidentifiedAccess(),
|
||||
userCapabilities,
|
||||
UserCapabilities.createForAccount(accountProfile.get()),
|
||||
username.orElse(null),
|
||||
null,
|
||||
null);
|
||||
|
||||
@@ -6,8 +6,17 @@
|
||||
package org.whispersystems.textsecuregcm.entities;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.whispersystems.textsecuregcm.storage.Account;
|
||||
|
||||
public class UserCapabilities {
|
||||
|
||||
public static UserCapabilities createForAccount(Account account) {
|
||||
return new UserCapabilities(
|
||||
account.isGroupsV2Supported(),
|
||||
account.isGv1MigrationSupported(),
|
||||
account.isSenderKeySupported());
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
private boolean gv2;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user