From 9563d020541c76858d75896d6dcdc460cba5b062 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Fri, 2 Feb 2024 09:32:45 +1000 Subject: [PATCH] FIX: Serialize uploaded_avatars_allowed_groups check on current user (#25515) Checking group permissions on the client does not work, since not all groups are serialized to the client all the time. We can check `uploaded_avatars_allowed_groups` on the server side and serialize to the current user instead. --- .../app/components/modal/avatar-selector.hbs | 6 +++--- .../discourse/app/components/modal/avatar-selector.js | 11 ++--------- .../tests/acceptance/user-preferences-account-test.js | 2 +- app/serializers/current_user_serializer.rb | 5 +++++ config/site_settings.yml | 1 - spec/system/page_objects/modals/avatar_selector.rb | 11 ++++++++++- .../system/user_page/user_preferences_account_spec.rb | 9 ++++++++- .../user_page/user_preferences_interface_spec.rb | 2 +- .../user_page/user_preferences_navigation_spec.rb | 2 +- .../user_page/user_preferences_security_spec.rb | 2 +- 10 files changed, 32 insertions(+), 19 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/modal/avatar-selector.hbs b/app/assets/javascripts/discourse/app/components/modal/avatar-selector.hbs index e14cba0b396..e8c82a839d6 100644 --- a/app/assets/javascripts/discourse/app/components/modal/avatar-selector.hbs +++ b/app/assets/javascripts/discourse/app/components/modal/avatar-selector.hbs @@ -17,11 +17,11 @@ {{/each}} - {{#if this.showAvatarUploader}} + {{#if this.showCustomAvatarSelector}}

{{i18n "user.change_avatar.use_custom"}}

{{/if}} {{/if}} - {{#if this.showAvatarUploader}} + {{#if this.showCustomAvatarSelector}} {{#if this.user.use_logo_small_as_avatar}}
<:footer> - {{#if this.showAvatarUploader}} + {{#if this.showCustomAvatarSelector}}