mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 10:08:01 +01:00
Rename name to id in the stored badge information and expose id in the profile endpoint
This commit is contained in:
@@ -90,7 +90,9 @@ public class ConfiguredProfileBadgeConverter implements ProfileBadgeConverter {
|
||||
.filter(accountBadge -> accountBadge.isVisible()
|
||||
&& now.isBefore(accountBadge.getExpiration())
|
||||
&& knownBadges.containsKey(accountBadge.getId()))
|
||||
.map(accountBadge -> new Badge(knownBadges.get(accountBadge.getId()).getImageUrl(),
|
||||
.map(accountBadge -> new Badge(
|
||||
accountBadge.getId(),
|
||||
knownBadges.get(accountBadge.getId()).getImageUrl(),
|
||||
resourceBundle.getString(accountBadge.getId() + "_name"),
|
||||
resourceBundle.getString(accountBadge.getId() + "_description")))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -11,20 +11,27 @@ import java.net.URL;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Badge {
|
||||
private final String id;
|
||||
private final URL imageUrl;
|
||||
private final String name;
|
||||
private final String description;
|
||||
|
||||
@JsonCreator
|
||||
public Badge(
|
||||
@JsonProperty("id") final String id,
|
||||
@JsonProperty("imageUrl") final URL imageUrl,
|
||||
@JsonProperty("name") final String name,
|
||||
@JsonProperty("description") final String description) {
|
||||
this.id = id;
|
||||
this.imageUrl = imageUrl;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public URL getImageUrl() {
|
||||
return imageUrl;
|
||||
}
|
||||
@@ -46,12 +53,13 @@ public class Badge {
|
||||
return false;
|
||||
}
|
||||
Badge badge = (Badge) o;
|
||||
return Objects.equals(imageUrl, badge.imageUrl) && Objects.equals(name,
|
||||
badge.name) && Objects.equals(description, badge.description);
|
||||
return Objects.equals(id, badge.id) && Objects.equals(imageUrl,
|
||||
badge.imageUrl) && Objects.equals(name, badge.name) && Objects.equals(
|
||||
description, badge.description);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(imageUrl, name, description);
|
||||
return Objects.hash(id, imageUrl, name, description);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user