mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 05:28:05 +01:00
Change name to id on AccountBadge
This makes it distinct from the localized name field on the Badge entity that is returned.
This commit is contained in:
@@ -89,10 +89,10 @@ public class ConfiguredProfileBadgeConverter implements ProfileBadgeConverter {
|
||||
return accountBadges.stream()
|
||||
.filter(accountBadge -> accountBadge.isVisible()
|
||||
&& now.isBefore(accountBadge.getExpiration())
|
||||
&& knownBadges.containsKey(accountBadge.getName()))
|
||||
.map(accountBadge -> new Badge(knownBadges.get(accountBadge.getName()).getImageUrl(),
|
||||
resourceBundle.getString(accountBadge.getName() + "_name"),
|
||||
resourceBundle.getString(accountBadge.getName() + "_description")))
|
||||
&& knownBadges.containsKey(accountBadge.getId()))
|
||||
.map(accountBadge -> new Badge(knownBadges.get(accountBadge.getId()).getImageUrl(),
|
||||
resourceBundle.getString(accountBadge.getId() + "_name"),
|
||||
resourceBundle.getString(accountBadge.getId() + "_description")))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ public class Account {
|
||||
public void removeBadge(String name) {
|
||||
requireNotStale();
|
||||
|
||||
badges.removeIf(accountBadge -> Objects.equals(accountBadge.getName(), name));
|
||||
badges.removeIf(accountBadge -> Objects.equals(accountBadge.getId(), name));
|
||||
purgeStaleBadges();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,22 +12,22 @@ import java.util.Objects;
|
||||
|
||||
public class AccountBadge {
|
||||
|
||||
private final String name;
|
||||
private final String id;
|
||||
private final Instant expiration;
|
||||
private final boolean visible;
|
||||
|
||||
@JsonCreator
|
||||
public AccountBadge(
|
||||
@JsonProperty("name") String name,
|
||||
@JsonProperty("id") String id,
|
||||
@JsonProperty("expiration") Instant expiration,
|
||||
@JsonProperty("visible") boolean visible) {
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
this.expiration = expiration;
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Instant getExpiration() {
|
||||
@@ -47,19 +47,19 @@ public class AccountBadge {
|
||||
return false;
|
||||
}
|
||||
AccountBadge that = (AccountBadge) o;
|
||||
return visible == that.visible && Objects.equals(name, that.name)
|
||||
return visible == that.visible && Objects.equals(id, that.id)
|
||||
&& Objects.equals(expiration, that.expiration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, expiration, visible);
|
||||
return Objects.hash(id, expiration, visible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountBadge{" +
|
||||
"name='" + name + '\'' +
|
||||
"id='" + id + '\'' +
|
||||
", expiration=" + expiration +
|
||||
", visible=" + visible +
|
||||
'}';
|
||||
|
||||
Reference in New Issue
Block a user