mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 10:28:04 +01:00
Ensure badges are in ordered collections
This commit is contained in:
@@ -14,7 +14,6 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.ResourceBundle.Control;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import org.whispersystems.textsecuregcm.configuration.BadgeConfiguration;
|
||||
@@ -50,11 +49,11 @@ public class ConfiguredProfileBadgeConverter implements ProfileBadgeConverter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Badge> convert(
|
||||
public List<Badge> convert(
|
||||
final List<Locale> acceptableLanguages,
|
||||
final Set<AccountBadge> accountBadges) {
|
||||
final List<AccountBadge> accountBadges) {
|
||||
if (accountBadges.isEmpty()) {
|
||||
return Set.of();
|
||||
return List.of();
|
||||
}
|
||||
|
||||
final Instant now = clock.instant();
|
||||
@@ -94,6 +93,6 @@ public class ConfiguredProfileBadgeConverter implements ProfileBadgeConverter {
|
||||
.map(accountBadge -> new Badge(knownBadges.get(accountBadge.getName()).getImageUrl(),
|
||||
resourceBundle.getString(accountBadge.getName() + "_name"),
|
||||
resourceBundle.getString(accountBadge.getName() + "_description")))
|
||||
.collect(Collectors.toSet());
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ package org.whispersystems.textsecuregcm.badges;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import org.whispersystems.textsecuregcm.entities.Badge;
|
||||
import org.whispersystems.textsecuregcm.storage.AccountBadge;
|
||||
|
||||
@@ -17,5 +16,5 @@ public interface ProfileBadgeConverter {
|
||||
* Converts the {@link AccountBadge}s for an account into the objects
|
||||
* that can be returned on a profile fetch.
|
||||
*/
|
||||
Set<Badge> convert(List<Locale> acceptableLanguages, Set<AccountBadge> accountBadges);
|
||||
List<Badge> convert(List<Locale> acceptableLanguages, List<AccountBadge> accountBadges);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user