Commit 051cfe45 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'add-approval-system-note-icons' into 'master'

Add icon for approvals in MR

See merge request !1641
parents cb716716 0b4bcb52
...@@ -16,7 +16,9 @@ module SystemNoteHelper ...@@ -16,7 +16,9 @@ module SystemNoteHelper
'visible' => 'icon_eye', 'visible' => 'icon_eye',
'milestone' => 'icon_clock_o', 'milestone' => 'icon_clock_o',
'discussion' => 'icon_comment_o', 'discussion' => 'icon_comment_o',
'moved' => 'icon_arrow_circle_o_right' 'moved' => 'icon_arrow_circle_o_right',
'approved' => 'icon_check',
'unapproved' => 'icon_fa_close'
}.freeze }.freeze
def icon_for_system_note(note) def icon_for_system_note(note)
......
...@@ -2,7 +2,7 @@ class SystemNoteMetadata < ActiveRecord::Base ...@@ -2,7 +2,7 @@ class SystemNoteMetadata < ActiveRecord::Base
ICON_TYPES = %w[ ICON_TYPES = %w[
commit merge confidential visible label assignee cross_reference commit merge confidential visible label assignee cross_reference
title time_tracking branch milestone discussion task moved opened closed merged title time_tracking branch milestone discussion task moved opened closed merged
approvals approved unapproved
].freeze ].freeze
validates :note, presence: true validates :note, presence: true
......
...@@ -488,13 +488,13 @@ module SystemNoteService ...@@ -488,13 +488,13 @@ module SystemNoteService
def approve_mr(noteable, user) def approve_mr(noteable, user)
body = "approved this merge request" body = "approved this merge request"
create_note(NoteSummary.new(noteable, noteable.project, user, body, action: 'approvals')) create_note(NoteSummary.new(noteable, noteable.project, user, body, action: 'approved'))
end end
def unapprove_mr(noteable, user) def unapprove_mr(noteable, user)
body = "unapproved this merge request" body = "unapproved this merge request"
create_note(NoteSummary.new(noteable, noteable.project, user, body, action: 'approvals')) create_note(NoteSummary.new(noteable, noteable.project, user, body, action: 'unapproved'))
end end
private private
......
<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1671 566q0 40-28 68l-724 724-136 136q-28 28-68 28t-68-28l-136-136-362-362q-28-28-28-68t28-68l136-136q28-28 68-28t68 28l294 295 656-657q28-28 68-28t68 28l136 136q28 28 28 68z"/></svg>
<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1490 1322q0 40-28 68l-136 136q-28 28-68 28t-68-28l-294-294-294 294q-28 28-68 28t-68-28l-136-136q-28-28-28-68t28-68l294-294-294-294q-28-28-28-68t28-68l136-136q28-28 68-28t68 28l294 294 294-294q28-28 68-28t68 28l136 136q28 28 28 68t-28 68l-294 294 294 294q28 28 28 68z"/></svg>
...@@ -807,7 +807,7 @@ describe SystemNoteService, services: true do ...@@ -807,7 +807,7 @@ describe SystemNoteService, services: true do
subject { described_class.approve_mr(noteable, author) } subject { described_class.approve_mr(noteable, author) }
it_behaves_like 'a system note' do it_behaves_like 'a system note' do
let(:action) { 'approvals' } let(:action) { 'approved' }
end end
context 'when merge request approved' do context 'when merge request approved' do
...@@ -817,6 +817,21 @@ describe SystemNoteService, services: true do ...@@ -817,6 +817,21 @@ describe SystemNoteService, services: true do
end end
end end
describe '.unapprove_mr' do
let(:noteable) { create(:merge_request, source_project: project) }
subject { described_class.unapprove_mr(noteable, author) }
it_behaves_like 'a system note' do
let(:action) { 'unapproved' }
end
context 'when merge request approved' do
it 'sets the note text' do
expect(subject.note).to eq "unapproved this merge request"
end
end
end
describe '.change_time_estimate' do describe '.change_time_estimate' do
subject { described_class.change_time_estimate(noteable, project, author) } subject { described_class.change_time_estimate(noteable, project, author) }
......
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