Skip to content

Commit

Permalink
Include only node notes in liquid notes
Browse files Browse the repository at this point in the history
  • Loading branch information
aapomm committed Jun 24, 2024
1 parent cdaa662 commit 1ba771f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions app/services/liquid_cached_assigns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def project_records(record_type)
project.evidence
when 'nodes'
project.nodes.user_nodes
when 'notes'
# FIXME - ISSUE/NOTE INHERITANCE
project.notes.includes(:node).where.not(node: { type_id: Node::Types::ISSUELIB })
else
project.send(record_type.to_sym)
end
Expand Down
6 changes: 4 additions & 2 deletions spec/services/liquid_cached_assigns_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
end

it 'builds a hash of liquid assigns' do
issues = project.issues.map(&:title)

expect(liquid_assigns['project'].name).to eq(project.name)
expect(liquid_assigns['issues'].map(&:title)).to eq(project.issues.map(&:title))
expect(liquid_assigns['issues'].map(&:title)).to eq(issues)
expect(liquid_assigns['evidences'].map(&:title)).to eq(project.evidence.map(&:title))
expect(liquid_assigns['nodes'].map(&:label)).to eq(project.nodes.user_nodes.map(&:label))
expect(liquid_assigns['notes'].map(&:title)).to eq(project.notes.map(&:title))
expect(liquid_assigns['notes'].map(&:title)).to eq(project.notes.map(&:title) - issues)
expect(liquid_assigns['tags'].map(&:display_name)).to eq(project.tags.map(&:display_name))
end
end
Expand Down

0 comments on commit 1ba771f

Please sign in to comment.