From de21b8622702adb7036babc88c4f6cfa62576161 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 31 Jul 2026 13:43:13 +0200 Subject: Let shortcode aggregate log but remove failed shortcode itself --- app/helpers/content_helper.rb | 6 +++++- config/locales/de.yml | 1 + config/locales/en.yml | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb index fd351ed2..935ed7b8 100644 --- a/app/helpers/content_helper.rb +++ b/app/helpers/content_helper.rb @@ -124,7 +124,11 @@ module ContentHelper end rescue - sanitize(content, :attributes => cccms_attributes) + Rails.logger.error("aggregate shortcode failed on page #{@page&.id}: #{e.class}: #{e.message}") + fallback = content.sub(/\[aggregate[^\]]*\]/, "") + fallback = sanitize(fallback, :attributes => cccms_attributes) + fallback += content_tag(:p, t("content.aggregate_failed"), :class => "error_messages") if current_user + fallback end end diff --git a/config/locales/de.yml b/config/locales/de.yml index 521aca8b..6cf32831 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -163,6 +163,7 @@ de: title: "Termine" tags: title: "Tags" + aggregate_failed: "Fehler: Der [aggregate]-Shortcode auf dieser Seite konnte nicht ausgeführt werden." search: index: diff --git a/config/locales/en.yml b/config/locales/en.yml index 9bf51262..fbb683ce 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -110,6 +110,7 @@ en: title: "Calendar" tags: title: "Tags" + aggregate_failed: "Error: the [aggregate] shortcode on this page could not be evaluated." search: index: -- cgit v1.3