Only update other avatars in one place
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Prevent future mistakes
This commit is contained in:
parent
c3b845b18f
commit
027b125285
@ -35,8 +35,7 @@ class SettingsController < ApplicationController
|
|||||||
|
|
||||||
if @user.avatar_new.present?
|
if @user.avatar_new.present?
|
||||||
if store_user_avatar
|
if store_user_avatar
|
||||||
LdapManager::UpdateAvatar.call(user: @user)
|
UserManager::UpdateAvatar.call(user: @user)
|
||||||
XmppSetAvatarJob.perform_later(user: @user) if Setting.ejabberd_enabled?
|
|
||||||
else
|
else
|
||||||
@validation_errors = @user.errors
|
@validation_errors = @user.errors
|
||||||
render :show, status: :unprocessable_entity and return
|
render :show, status: :unprocessable_entity and return
|
||||||
|
@ -7,8 +7,7 @@ module UserManager
|
|||||||
|
|
||||||
def call
|
def call
|
||||||
if import_remote_avatar
|
if import_remote_avatar
|
||||||
LdapManager::UpdateAvatar.call(user: @user)
|
UserManager::UpdateAvatar.call(user: @user)
|
||||||
XmppSetAvatarJob.perform_later(user: @user) if Setting.ejabberd_enabled?
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
15
app/services/user_manager/update_avatar.rb
Normal file
15
app/services/user_manager/update_avatar.rb
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
module UserManager
|
||||||
|
class UpdateAvatar < UserManagerService
|
||||||
|
def initialize(user:)
|
||||||
|
@user = user
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
LdapManager::UpdateAvatar.call(user: @user)
|
||||||
|
|
||||||
|
if Setting.ejabberd_enabled?
|
||||||
|
XmppSetAvatarJob.perform_later(user: @user)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user