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
def text_for_change(value)
changed = ["Changed #{value}"]
changed << "from #{@details[:from]}" if @details[:from]
changed << "to #{@details[:to]}" if @details[:to]
changed << "from #{@details[:from]}" if @details[:from].to_s.present?
changed << "to #{@details[:to]}" if @details[:to].to_s.present?
if access_level_changed?(value) && expiry_details_available?
changed << text_for_expiry_change
......
......@@ -130,6 +130,25 @@ describe Audit::Details do
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
context 'group' do
......@@ -197,13 +216,13 @@ describe Audit::Details do
context 'change email' do
let(:action) do
{
change: 'email',
from: 'a@b.com',
to: 'c@b.com',
author_name: 'author',
target_id: '',
target_type: 'Email',
target_details: 'Email'
change: 'email',
from: 'a@b.com',
to: 'c@b.com',
author_name: 'author',
target_id: '',
target_type: 'Email',
target_details: 'Email'
}
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