discourse/spec/system/user_page/user_preferences_account_spec.rb
Krzysztof Kotlarek 1017820012
DEV: Convert allow_uploaded_avatars to groups (#24810)
This change converts the allow_uploaded_avatars site setting to uploaded_avatars_allowed_groups.

See: https://meta.discourse.org/t/283408

Hides the old setting
Adds the new site setting
Adds a deprecation warning
Updates to use the new setting
Adds a migration to fill in the new setting if the old setting was changed
Adds an entry to the site_setting.keywords section
Updates tests to account for the new change
After a couple of months, we will remove the allow_uploaded_avatars setting entirely.

Internal ref: /t/117248
2023-12-13 10:53:19 +11:00

30 lines
1.3 KiB
Ruby

# frozen_string_literal: true
describe "User preferences for Account", type: :system do
fab!(:user) { Fabricate(:user, refresh_auto_groups: true) }
let(:user_account_preferences_page) { PageObjects::Pages::UserPreferencesAccount.new }
let(:avatar_selector_modal) { PageObjects::Modals::AvatarSelector.new }
before { sign_in(user) }
describe "avatar-selector modal" do
it "saves custom picture and system assigned pictures" do
user_account_preferences_page.open_avatar_selector_modal(user)
expect(avatar_selector_modal).to be_open
avatar_selector_modal.select_avatar_upload_option
file_path = File.absolute_path(file_from_fixtures("logo.jpg"))
attach_file(file_path) { avatar_selector_modal.click_avatar_upload_button }
expect(avatar_selector_modal).to have_user_avatar_image_uploaded
avatar_selector_modal.click_primary_button
expect(avatar_selector_modal).to be_closed
expect(user_account_preferences_page).to have_custom_uploaded_avatar_image
user_account_preferences_page.open_avatar_selector_modal(user)
avatar_selector_modal.select_system_assigned_option
avatar_selector_modal.click_primary_button
expect(avatar_selector_modal).to be_closed
expect(user_account_preferences_page).to have_system_avatar_image
end
end
end