mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 10:28:12 +01:00
Add a "sameAvatar" flag to CreateProfileRequest
If sameAvatar is set (and "avatar" is also set), the avatar field for a profile will be copied from the existing profile. This saves S3 churn and client bandwidth.
This commit is contained in:
@@ -30,6 +30,9 @@ public class CreateProfileRequest {
|
||||
@JsonProperty
|
||||
private boolean avatar;
|
||||
|
||||
@JsonProperty
|
||||
private boolean sameAvatar;
|
||||
|
||||
@JsonProperty
|
||||
@ExactlySize({0, 80})
|
||||
private String aboutEmoji;
|
||||
@@ -57,7 +60,7 @@ public class CreateProfileRequest {
|
||||
|
||||
public CreateProfileRequest(
|
||||
ProfileKeyCommitment commitment, String version, String name, String aboutEmoji, String about,
|
||||
String paymentAddress, boolean wantsAvatar, List<String> badgeIds) {
|
||||
String paymentAddress, boolean wantsAvatar, boolean sameAvatar, List<String> badgeIds) {
|
||||
this.commitment = commitment;
|
||||
this.version = version;
|
||||
this.name = name;
|
||||
@@ -65,6 +68,7 @@ public class CreateProfileRequest {
|
||||
this.about = about;
|
||||
this.paymentAddress = paymentAddress;
|
||||
this.avatar = wantsAvatar;
|
||||
this.sameAvatar = sameAvatar;
|
||||
this.badgeIds = badgeIds;
|
||||
}
|
||||
|
||||
@@ -80,10 +84,26 @@ public class CreateProfileRequest {
|
||||
return name;
|
||||
}
|
||||
|
||||
public boolean isAvatar() {
|
||||
public boolean hasAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public enum AvatarChange {
|
||||
UNCHANGED,
|
||||
CLEAR,
|
||||
UPDATE;
|
||||
}
|
||||
|
||||
public AvatarChange getAvatarChange() {
|
||||
if (!hasAvatar()) {
|
||||
return AvatarChange.CLEAR;
|
||||
}
|
||||
if (!sameAvatar) {
|
||||
return AvatarChange.UPDATE;
|
||||
}
|
||||
return AvatarChange.UNCHANGED;
|
||||
}
|
||||
|
||||
public String getAboutEmoji() {
|
||||
return StringUtils.stripToNull(aboutEmoji);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user