Commit 12fc5458 authored by James Lopez's avatar James Lopez

fix specs, fix small bug in details

parent f9f32231
...@@ -97,7 +97,6 @@ module EE ...@@ -97,7 +97,6 @@ module EE
def unauth_security_event def unauth_security_event
return unless audit_events_enabled? return unless audit_events_enabled?
@details.delete(:ip_address) unless admin_audit_log_enabled? @details.delete(:ip_address) unless admin_audit_log_enabled?
@details[:entity_path] = @entity&.full_path @details[:entity_path] = @entity&.full_path
...@@ -127,33 +126,33 @@ module EE ...@@ -127,33 +126,33 @@ module EE
custom_message = @details[:custom_message] custom_message = @details[:custom_message]
@details = @details =
case action case action
when :destroy when :destroy
{ {
remove: model, remove: model,
author_name: @author.name, author_name: @author.name,
target_id: key_title, target_id: key_title,
target_type: model_class, target_type: model_class,
target_details: key_title target_details: key_title
} }
when :create when :create
{ {
add: model, add: model,
author_name: @author.name, author_name: @author.name,
target_id: key_title, target_id: key_title,
target_type: model_class, target_type: model_class,
target_details: key_title target_details: key_title
} }
when :custom when :custom
{ {
custom_message: custom_message, custom_message: custom_message,
author_name: @author&.name, author_name: @author&.name,
target_id: key_title, target_id: key_title,
target_type: model_class, target_type: model_class,
target_details: key_title, target_details: key_title,
ip_address: @details[:ip_address] ip_address: @details[:ip_address]
} }
end end
self self
end end
......
...@@ -31,8 +31,8 @@ module Audit ...@@ -31,8 +31,8 @@ module Audit
"Removed #{value}" "Removed #{value}"
when :failed_login when :failed_login
"Failed to login with #{Gitlab::OAuth::Provider.label_for(value).upcase} authentication" "Failed to login with #{Gitlab::OAuth::Provider.label_for(value).upcase} authentication"
when :custom when :custom_message
value value
else else
text_for_change(value) text_for_change(value)
end end
......
...@@ -489,14 +489,6 @@ describe API::Users do ...@@ -489,14 +489,6 @@ describe API::Users do
expect(user.reload.organization).to eq('GitLab') expect(user.reload.organization).to eq('GitLab')
end end
it 'updates user with a new email' do
put api("/users/#{user.id}", admin), email: 'new@email.com'
expect(response).to have_http_status(200)
expect(user.reload.notification_email).to eq('new@email.com')
expect(AuditEvent.count).to eq(1)
end
it 'updates user with avatar' do it 'updates user with avatar' do
put api("/users/#{user.id}", admin), { avatar: fixture_file_upload(Rails.root + 'spec/fixtures/banana_sample.gif', 'image/gif') } put api("/users/#{user.id}", admin), { avatar: fixture_file_upload(Rails.root + 'spec/fixtures/banana_sample.gif', 'image/gif') }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment