Commit d4ab5237 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'tancnle/fix-parsing-audit-event-action' into 'master'

Fix incorrect parsing of audit event action

See merge request gitlab-org/gitlab!26426
parents 8cc37ed4 a2e03069
...@@ -54,8 +54,8 @@ module Audit ...@@ -54,8 +54,8 @@ module Audit
def text_for_change(value) def text_for_change(value)
changed = ["Changed #{value}"] changed = ["Changed #{value}"]
changed << "from #{@details[:from]}" if @details[:from] changed << "from #{@details[:from]}" if @details[:from].to_s.present?
changed << "to #{@details[:to]}" if @details[:to] changed << "to #{@details[:to]}" if @details[:to].to_s.present?
if access_level_changed?(value) && expiry_details_available? if access_level_changed?(value) && expiry_details_available?
changed << text_for_expiry_change changed << text_for_expiry_change
......
...@@ -130,6 +130,25 @@ describe Audit::Details do ...@@ -130,6 +130,25 @@ describe Audit::Details do
end end
end end
end end
context 'update merge request approval permissions' do
let(:merge_request_approval_action) do
{
change: 'prevent merge request approval from authors',
from: false,
to: true,
author_name: user.name,
target_id: project.id,
target_type: 'ApprovalProjectRules'
}
end
it 'humanizes merge request approval permissions action' do
string = described_class.humanize(merge_request_approval_action)
expect(string).to eq('Changed prevent merge request approval from authors from false to true')
end
end
end end
context 'group' do context 'group' do
...@@ -197,13 +216,13 @@ describe Audit::Details do ...@@ -197,13 +216,13 @@ describe Audit::Details do
context 'change email' do context 'change email' do
let(:action) do let(:action) do
{ {
change: 'email', change: 'email',
from: 'a@b.com', from: 'a@b.com',
to: 'c@b.com', to: 'c@b.com',
author_name: 'author', author_name: 'author',
target_id: '', target_id: '',
target_type: 'Email', target_type: 'Email',
target_details: 'Email' target_details: 'Email'
} }
end end
......
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