mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 08:18:18 +08:00
d1bdb6c65d
* FEATURE: upload an avatar option for uploading avatars with selectable avatars Allow staff or users at or above a trust level to upload avatars even when the site has selectable avatars enabled. Everyone can still pick from the list of avatars. The option to upload is shown below the selectable avatar list. refactored boolean site setting into an enum with the following values: disabled: No selectable avatars enabled (default) everyone: Show selectable avatars, and allow everyone to upload custom avatars tl1: Show selectable avatars, but require tl1+ and staff to upload custom avatars tl2: Show selectable avatars, but require tl2+ and staff to upload custom avatars tl3: Show selectable avatars, but require tl3+ and staff to upload custom avatars tl4: Show selectable avatars, but require tl4 and staff to upload custom avatars staff: Show selectable avatars, but only allow staff to upload custom avatars no_one: Show selectable avatars. No users can upload custom avatars Co-authored-by: Régis Hanol <regis@hanol.fr>
16 lines
310 B
Ruby
16 lines
310 B
Ruby
# frozen_string_literal: true
|
|
|
|
class SelectableAvatarsModeValidator
|
|
def initialize(opts = {})
|
|
@opts = opts
|
|
end
|
|
|
|
def valid_value?(value)
|
|
value == "disabled" || SiteSetting.selectable_avatars.size > 1
|
|
end
|
|
|
|
def error_message
|
|
I18n.t('site_settings.errors.empty_selectable_avatars')
|
|
end
|
|
end
|