Commit 0b4bcb52 authored by Jarka Kadlecova's avatar Jarka Kadlecova

Split approve and unaprove icons

parent 2c32ece2
......@@ -17,7 +17,8 @@ module SystemNoteHelper
'milestone' => 'icon_clock_o',
'discussion' => 'icon_comment_o',
'moved' => 'icon_arrow_circle_o_right',
'approvals' => 'icon_check'
'approved' => 'icon_check',
'unapproved' => 'icon_fa_close'
}.freeze
def icon_for_system_note(note)
......
......@@ -2,7 +2,7 @@ class SystemNoteMetadata < ActiveRecord::Base
ICON_TYPES = %w[
commit merge confidential visible label assignee cross_reference
title time_tracking branch milestone discussion task moved opened closed merged
approvals
approved unapproved
].freeze
validates :note, presence: true
......
......@@ -488,13 +488,13 @@ module SystemNoteService
def approve_mr(noteable, user)
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
def unapprove_mr(noteable, user)
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
private
......
......@@ -807,7 +807,7 @@ describe SystemNoteService, services: true do
subject { described_class.approve_mr(noteable, author) }
it_behaves_like 'a system note' do
let(:action) { 'approvals' }
let(:action) { 'approved' }
end
context 'when merge request approved' do
......@@ -817,6 +817,21 @@ describe SystemNoteService, services: true do
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
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