mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: The Site's logo is the selected option when changing the system's user avatar. (#12861)
If the "use_site_small_logo_as_system_avatar" setting is enabled, the site's small logo is displayed as the selected option by the avatar-selector. Choosing a different avatar disables the setting.
This commit is contained in:
@@ -1129,11 +1129,9 @@ class UsersController < ApplicationController
|
||||
|
||||
if type.blank? || type == 'system'
|
||||
upload_id = nil
|
||||
elsif !SiteSetting.allow_uploaded_avatars
|
||||
return render json: failed_json, status: 422
|
||||
else
|
||||
if !SiteSetting.allow_uploaded_avatars
|
||||
return render json: failed_json, status: 422
|
||||
end
|
||||
|
||||
upload_id = params[:upload_id]
|
||||
upload = Upload.find_by(id: upload_id)
|
||||
|
||||
@@ -1153,6 +1151,10 @@ class UsersController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
if user.is_system_user?
|
||||
SiteSetting.use_site_small_logo_as_system_avatar = false
|
||||
end
|
||||
|
||||
user.uploaded_avatar_id = upload_id
|
||||
user.save!
|
||||
user.user_avatar.save!
|
||||
@@ -1187,6 +1189,11 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
user.uploaded_avatar_id = upload.id
|
||||
|
||||
if user.is_system_user?
|
||||
SiteSetting.use_site_small_logo_as_system_avatar = false
|
||||
end
|
||||
|
||||
user.save!
|
||||
|
||||
avatar = user.user_avatar || user.create_user_avatar
|
||||
|
||||
Reference in New Issue
Block a user