From 917a0cfe47bad420a894fe8ca35d7dd95ebb5a7c Mon Sep 17 00:00:00 2001 From: talyz Date: Fri, 1 Oct 2021 11:03:47 +0200 Subject: [PATCH] discourse: Make sure the notification email setting applies Discourse normally overrides the default notification email setting, which makes the `notificationEmailAddress` setting ineffective. Add a patch to remove this override. Fixes #140114. --- pkgs/servers/web-apps/discourse/default.nix | 3 +++ .../discourse/notification_email.patch | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 pkgs/servers/web-apps/discourse/notification_email.patch diff --git a/pkgs/servers/web-apps/discourse/default.nix b/pkgs/servers/web-apps/discourse/default.nix index 0b806e83f949..592b981dd772 100644 --- a/pkgs/servers/web-apps/discourse/default.nix +++ b/pkgs/servers/web-apps/discourse/default.nix @@ -263,6 +263,9 @@ let # defaults to the plugin's directory and isn't writable at the # time of asset generation ./auto_generated_path.patch + + # Make sure the notification email setting applies + ./notification_email.patch ]; postPatch = '' diff --git a/pkgs/servers/web-apps/discourse/notification_email.patch b/pkgs/servers/web-apps/discourse/notification_email.patch new file mode 100644 index 000000000000..9a64b1c1f9ea --- /dev/null +++ b/pkgs/servers/web-apps/discourse/notification_email.patch @@ -0,0 +1,18 @@ +diff --git a/db/fixtures/990_settings.rb b/db/fixtures/990_settings.rb +deleted file mode 100644 +index 6f21e58813..0000000000 +--- a/db/fixtures/990_settings.rb ++++ /dev/null +@@ -1,12 +0,0 @@ +-# frozen_string_literal: true +- +-if SiteSetting.notification_email == SiteSetting.defaults[:notification_email] +- # don't crash for invalid hostname, which is possible in dev +- begin +- SiteSetting.notification_email = "noreply@#{Discourse.current_hostname}" +- rescue Discourse::InvalidParameters +- if Rails.env.production? +- STDERR.puts "WARNING: Discourse hostname: #{Discourse.current_hostname} is not a valid domain for emails!" +- end +- end +-end