summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/event.rb2
-rw-r--r--spec/models/event_spec.rb8
2 files changed, 5 insertions, 5 deletions
diff --git a/app/models/event.rb b/app/models/event.rb
index e0c52fed6fb..fd736d12359 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -136,7 +136,7 @@ class Event < ActiveRecord::Base
end
def note?
- %w[Note LegacyDiffNote].include?(target_type)
+ target.is_a?(Note)
end
def issue?
diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb
index 00925591a5e..6ac19756f15 100644
--- a/spec/models/event_spec.rb
+++ b/spec/models/event_spec.rb
@@ -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 }