Commit 727412ab authored by Jarka Kadlecova's avatar Jarka Kadlecova

Create system note metadata - EE specific

parent 752d447e
class SystemNoteMetadata < ActiveRecord::Base
ICON_TYPES = %w[
commit merge confidentiality status label assignee cross_reference
title time_tracking branch milestone discussion task moved
title time_tracking branch milestone discussion task moved approvals
].freeze
validates :note, presence: true
......
......@@ -482,12 +482,13 @@ module SystemNoteService
def approve_mr(noteable, user)
body = "approved this merge request"
create_note(noteable: noteable, project: noteable.project, author: user, note: body)
create_note(NoteSummary.new(noteable, noteable.project, user, body, action: 'approvals'))
end
def unapprove_mr(noteable, user)
body = "unapproved this merge request"
create_note(noteable: noteable, project: noteable.project, author: user, note: body)
create_note(NoteSummary.new(noteable, noteable.project, user, body, action: 'approvals'))
end
private
......
......@@ -794,7 +794,9 @@ describe SystemNoteService, services: true do
let(:noteable) { create(:merge_request, source_project: project) }
subject { described_class.approve_mr(noteable, author) }
it_behaves_like 'a system note'
it_behaves_like 'a system note' do
let(:action) { 'approvals' }
end
context 'when merge request approved' do
it 'sets the note text' do
......@@ -806,7 +808,9 @@ describe SystemNoteService, services: true do
describe '.change_time_estimate' do
subject { described_class.change_time_estimate(noteable, project, author) }
it_behaves_like 'a system note'
it_behaves_like 'a system note' do
let(:action) { 'time_tracking' }
end
context 'with a time estimate' do
it 'sets the note text' do
......@@ -836,7 +840,9 @@ describe SystemNoteService, services: true do
described_class.change_time_spent(noteable, project, author)
end
it_behaves_like 'a system note'
it_behaves_like 'a system note' do
let(:action) { 'time_tracking' }
end
context 'when time was added' do
it 'sets the note text' do
......
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