Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[39502] Try to remove all email notification parts from the footer

Oliver Günthera1d3f7e3cc7c
diff --git a/config/settings.yml b/config/settings.yml
index 81f28c94ff2..6766d737398 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -298,10 +298,7 @@ repository_log_display_limit:
default: 100
emails_footer:
serialized: true
- default:
- en: |-
- You have received this notification because you have either subscribed to it, or are involved in it.
- To change your notification preferences, please click here: {{opSetting:base_url}}/my/notifications
+ default: {}
start_of_week:
default: ''
first_week_of_year:
diff --git a/db/migrate/20211103120946_clean_emails_footer.rb b/db/migrate/20211103120946_clean_emails_footer.rb
new file mode 100644
index 00000000000..1a1a180d03e
--- /dev/null
+++ b/db/migrate/20211103120946_clean_emails_footer.rb
@@ -0,0 +1,34 @@
+class CleanEmailsFooter < ActiveRecord::Migration[6.1]
+ def up
+ Setting.reset_column_information
+ filtered_footer = Setting
+ .emails_footer
+ .reject do |locale, text|
+ if assumed_notification_text?(text)
+ warn "Removing emails footer for #{locale} as it matches the default notification syntax."
+ true
+ end
+ end
+
+ if filtered_footer.length < Setting.emails_footer.length
+ Setting.emails_footer = filtered_footer
+ end
+ end
+
+ def down
+ # Nothing to migrate
+ end
+
+ private
+
+ def assumed_notification_text?(text)
+ [
+ 'You have received this notification because of your notification settings',
+ 'You have received this notification because you have either subscribed to it, or are involved in it.',
+ 'Sie erhalten diese E-Mail aufgrund Ihrer Benachrichtungseinstellungen',
+ '/my/account',
+ '/my/notifications',
+ '/my/mail\_notifications'
+ ].any? { |val| text.include?(val) }
+ end
+end