FEATURE: upload an avatar option for uploading avatars with selectable avatars (#15878)

* 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>
This commit is contained in:
Jeff Wong
2022-02-24 10:57:39 -10:00
committed by GitHub
parent 00bb5f3a9d
commit d1bdb6c65d
13 changed files with 250 additions and 18 deletions

View File

@ -2141,7 +2141,7 @@ describe User do
avatar1 = Fabricate(:upload)
avatar2 = Fabricate(:upload)
SiteSetting.selectable_avatars = [avatar1, avatar2]
SiteSetting.selectable_avatars_enabled = true
SiteSetting.selectable_avatars_mode = "no_one"
user = Fabricate(:user)
expect(user.uploaded_avatar_id).not_to be(nil)