From 683526b38442a9873d83a542b5cba1d15efc14d5 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 31 Jul 2026 18:55:35 +0200 Subject: Bind aggregates over scoped tags to their subtree CccConventions::TAG_SCOPES maps "update" and "pressemitteilung" to /updates and "disclosure" to /disclosure. Page.aggregate applies the mapping, so an aggregate over one of those tags is bounded by its subtree regardless of what the shortcode says. Tags stay unrestricted; positions are publish-gated. Both RSS actions call Page.aggregate rather than repeating its tag join. Empty feeds no longer crash: Atom falls back to the current time for the required , and the optional dc:date is omitted. --- app/models/page.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/models') diff --git a/app/models/page.rb b/app/models/page.rb index cf003f74..a66527da 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -61,7 +61,7 @@ class Page < ApplicationRecord unless options[:tags].blank? tag_names = options[:tags].gsub(/\s/, ",").split(",").map(&:strip).map(&:downcase).uniq.reject(&:blank?) - unless tag_names.empty? + unless tag_names.empty? scope = scope .joins("JOIN taggings ON taggings.taggable_id = pages.id AND taggings.taggable_type = 'Page' @@ -71,6 +71,11 @@ class Page < ApplicationRecord .group("pages.id") .having("COUNT(DISTINCT tags.id) = ?", tag_names.length) end + + CccConventions::TAG_SCOPES.values_at(*tag_names).compact.uniq.each do |root| + scope = scope.where("nodes.unique_name = ? OR nodes.unique_name LIKE ?", + root, "#{root}/%") + end end if options[:node] && options[:children] == "direct" -- cgit v1.3