diff --git a/CHANGELOG.md b/CHANGELOG.md index ef7b37f57..da4212da9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - removed trust from the RPA radio button options text for conversions +### Fixed + +- The note added during DAO revocation only appears on the associated project + notes, instead of all projects. + ## [Release 92][release-92] ### Changed diff --git a/app/models/note.rb b/app/models/note.rb index 3f80d32b3..d209e151b 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -9,9 +9,7 @@ class Note < ApplicationRecord default_scope { order(created_at: "desc") } scope :project_level_notes, ->(project) { - where(project: project) - .where(notable_type: nil).where(task_identifier: nil) - .or(where.not(notable_type: "SignificantDateHistoryReason")) + where(project: project).where(notable_type: [nil, "DaoRevocationReason"]).where(task_identifier: nil) } # When no value is provided, Rails will store an empty string. Instead, we want to ensure diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index 5b5d426dd..f76581aea 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -35,6 +35,7 @@ end describe "project_level_notes" do + let!(:other_project) { create(:conversion_project) } let!(:project) { create(:conversion_project) } let!(:project_level_note) { create(:note, project: project) } let!(:task_level_note) { create(:note, task_identifier: "handover", project: project) } @@ -57,6 +58,12 @@ expect(subject).to include project_level_note expect(subject).to include dao_revocation_note end + + it "only include notes for the correct project" do + subject = Note.project_level_notes(other_project) + + expect(subject).not_to include dao_revocation_note + end end end