Take no action if badge list is omitted entirely

This commit is contained in:
Jon Chambers
2021-11-24 13:38:42 -05:00
committed by Jon Chambers
parent ebf24fb125
commit 6b71b66bd2
2 changed files with 9 additions and 7 deletions

View File

@@ -187,8 +187,9 @@ public class ProfileController {
response = Optional.of(generateAvatarUploadForm(avatar));
}
List<AccountBadge> updatedBadges = mergeBadgeIdsWithExistingAccountBadges(
request.getBadges(), auth.getAccount().getBadges());
List<AccountBadge> updatedBadges = request.getBadges()
.map(badges -> mergeBadgeIdsWithExistingAccountBadges(badges, auth.getAccount().getBadges()))
.orElseGet(() -> auth.getAccount().getBadges());
accountsManager.update(auth.getAccount(), a -> {
a.setProfileName(request.getName());