Commit 19e15ae2 authored by Rémy Coutable's avatar Rémy Coutable

Use a more future-proof check for Note/LegacyDiffNote

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 4834e2e6
......@@ -136,7 +136,7 @@ class Event < ActiveRecord::Base
end
def note?
%w[Note LegacyDiffNote].include?(target_type)
target.is_a?(Note)
end
def issue?
......
......@@ -55,8 +55,8 @@ describe Event, models: true do
it { is_expected.to be_note }
end
context 'merge request note event' do
let(:target) { create(:note_on_merge_request) }
context 'merge request diff note event' do
let(:target) { create(:note_on_merge_request_diff) }
it { is_expected.to be_note }
end
......@@ -129,10 +129,10 @@ describe Event, models: true do
end
end
context 'merge request note event' do
context 'merge request diff note event' do
let(:project) { create(:project, :public) }
let(:merge_request) { create(:merge_request, source_project: project, author: author, assignee: assignee) }
let(:note_on_merge_request) { create(:note_on_merge_request, noteable: merge_request, project: project) }
let(:note_on_merge_request) { create(:note_on_merge_request_diff, noteable: merge_request, project: project) }
let(:target) { note_on_merge_request }
it { expect(event.visible_to_user?(non_member)).to eq true }
......
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