Compare commits

..

No commits in common. "ae7291d4f155fc13441fae95134c0ac9c6790738" and "322ca98da94bd14969826ccb5c2afa85e614e8e8" have entirely different histories.

3 changed files with 7 additions and 22 deletions

View File

@ -36,7 +36,6 @@ class SettingsController < ApplicationController
if @user.avatar_new.present?
if store_user_avatar
LdapManager::UpdateAvatar.call(user: @user)
XmppSetAvatarJob.perform_later(user: @user)
else
@validation_errors = @user.errors
render :show, status: :unprocessable_entity and return

View File

@ -5,12 +5,11 @@ class XmppSetAvatarJob < ApplicationJob
queue_as :default
def perform(user:, overwrite: false)
return if Rails.env.development?
@user = user
unless overwrite
current_avatar = get_current_avatar
Rails.logger.info { "User #{user.cn} already has an avatar set" }
Rails.logger.debug { "User #{user.cn} already has an avatar set. Nothing to do." }
return if current_avatar.present?
end
@ -57,10 +56,6 @@ class XmppSetAvatarJob < ApplicationJob
end
end
<<<<<<< HEAD
=======
# See https://xmpp.org/extensions/xep-0084.html
>>>>>>> feature/ejabberd_pep
def build_xep0084_stanzas
img_data = process_avatar
sha1_hash = Digest::SHA1.hexdigest(img_data)

View File

@ -46,8 +46,6 @@ RSpec.describe 'Profile settings', type: :feature do
feature "Update avatar" do
scenario "fails with validation error for wrong content type" do
expect(LdapManager::UpdateAvatar).not_to receive(:call)
visit setting_path(:profile)
attach_file "Avatar", "#{Rails.root}/spec/fixtures/files/bitcoin.pdf"
click_button "Save"
@ -59,7 +57,8 @@ RSpec.describe 'Profile settings', type: :feature do
end
scenario "fails with validation error for file size too large" do
expect(LdapManager::UpdateAvatar).not_to receive(:call)
expect_any_instance_of(LdapManager::UpdateAvatar)
.not_to receive(:replace_attribute).and_return(true)
visit setting_path(:profile)
attach_file "Avatar", "#{Rails.root}/spec/fixtures/files/fsociety-irc.png"
@ -74,12 +73,8 @@ RSpec.describe 'Profile settings', type: :feature do
scenario 'works with valid JPG file' do
file_path = "#{Rails.root}/spec/fixtures/files/taipei.jpg"
expect(LdapManager::UpdateAvatar)
.to receive(:call).with(user: user)
.and_return(true)
expect(XmppSetAvatarJob)
.to receive(:perform_later).with(user: user)
.and_return(true)
expect_any_instance_of(LdapManager::UpdateAvatar)
.to receive(:replace_attribute).and_return(true)
visit setting_path(:profile)
attach_file "Avatar", file_path
@ -94,12 +89,8 @@ RSpec.describe 'Profile settings', type: :feature do
scenario 'works with valid PNG file' do
file_path = "#{Rails.root}/spec/fixtures/files/bender.png"
expect(LdapManager::UpdateAvatar)
.to receive(:call).with(user: user)
.and_return(true)
expect(XmppSetAvatarJob)
.to receive(:perform_later).with(user: user)
.and_return(true)
expect_any_instance_of(LdapManager::UpdateAvatar)
.to receive(:replace_attribute).and_return(true)
visit setting_path(:profile)
attach_file "Avatar", file_path