mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-07 12:52:11 -04:00
Centralise the custom template directory (#10596)
Several configuration sections are using separate settings for custom template directories, which can be confusing. This PR adds a new top-level configuration for a custom template directory which is then used for every module. The only exception is the consent templates, since the consent template directory require a specific hierarchy, so it's probably better that it stays separate from everything else.
This commit is contained in:
parent
c4cf0c0473
commit
5639759980
12 changed files with 342 additions and 418 deletions
|
@ -258,7 +258,12 @@ class EmailConfig(Config):
|
|||
add_threepid_template_success_html,
|
||||
],
|
||||
(
|
||||
td for td in (template_dir,) if td
|
||||
td
|
||||
for td in (
|
||||
self.root.server.custom_template_directory,
|
||||
template_dir,
|
||||
)
|
||||
if td
|
||||
), # Filter out template_dir if not provided
|
||||
)
|
||||
|
||||
|
@ -299,7 +304,14 @@ class EmailConfig(Config):
|
|||
self.email_notif_template_text,
|
||||
) = self.read_templates(
|
||||
[notif_template_html, notif_template_text],
|
||||
(td for td in (template_dir,) if td),
|
||||
(
|
||||
td
|
||||
for td in (
|
||||
self.root.server.custom_template_directory,
|
||||
template_dir,
|
||||
)
|
||||
if td
|
||||
), # Filter out template_dir if not provided
|
||||
)
|
||||
|
||||
self.email_notif_for_new_users = email_config.get(
|
||||
|
@ -322,7 +334,14 @@ class EmailConfig(Config):
|
|||
self.account_validity_template_text,
|
||||
) = self.read_templates(
|
||||
[expiry_template_html, expiry_template_text],
|
||||
(td for td in (template_dir,) if td),
|
||||
(
|
||||
td
|
||||
for td in (
|
||||
self.root.server.custom_template_directory,
|
||||
template_dir,
|
||||
)
|
||||
if td
|
||||
), # Filter out template_dir if not provided
|
||||
)
|
||||
|
||||
subjects_config = email_config.get("subjects", {})
|
||||
|
@ -354,6 +373,9 @@ class EmailConfig(Config):
|
|||
"""\
|
||||
# Configuration for sending emails from Synapse.
|
||||
#
|
||||
# Server admins can configure custom templates for email content. See
|
||||
# https://matrix-org.github.io/synapse/latest/templates.html for more information.
|
||||
#
|
||||
email:
|
||||
# The hostname of the outgoing SMTP server to use. Defaults to 'localhost'.
|
||||
#
|
||||
|
@ -430,49 +452,6 @@ class EmailConfig(Config):
|
|||
#
|
||||
#invite_client_location: https://app.element.io
|
||||
|
||||
# Directory in which Synapse will try to find the template files below.
|
||||
# If not set, or the files named below are not found within the template
|
||||
# directory, default templates from within the Synapse package will be used.
|
||||
#
|
||||
# Synapse will look for the following templates in this directory:
|
||||
#
|
||||
# * The contents of email notifications of missed events: 'notif_mail.html' and
|
||||
# 'notif_mail.txt'.
|
||||
#
|
||||
# * The contents of account expiry notice emails: 'notice_expiry.html' and
|
||||
# 'notice_expiry.txt'.
|
||||
#
|
||||
# * The contents of password reset emails sent by the homeserver:
|
||||
# 'password_reset.html' and 'password_reset.txt'
|
||||
#
|
||||
# * An HTML page that a user will see when they follow the link in the password
|
||||
# reset email. The user will be asked to confirm the action before their
|
||||
# password is reset: 'password_reset_confirmation.html'
|
||||
#
|
||||
# * HTML pages for success and failure that a user will see when they confirm
|
||||
# the password reset flow using the page above: 'password_reset_success.html'
|
||||
# and 'password_reset_failure.html'
|
||||
#
|
||||
# * The contents of address verification emails sent during registration:
|
||||
# 'registration.html' and 'registration.txt'
|
||||
#
|
||||
# * HTML pages for success and failure that a user will see when they follow
|
||||
# the link in an address verification email sent during registration:
|
||||
# 'registration_success.html' and 'registration_failure.html'
|
||||
#
|
||||
# * The contents of address verification emails sent when an address is added
|
||||
# to a Matrix account: 'add_threepid.html' and 'add_threepid.txt'
|
||||
#
|
||||
# * HTML pages for success and failure that a user will see when they follow
|
||||
# the link in an address verification email sent when an address is added
|
||||
# to a Matrix account: 'add_threepid_success.html' and
|
||||
# 'add_threepid_failure.html'
|
||||
#
|
||||
# You can see the default templates at:
|
||||
# https://github.com/matrix-org/synapse/tree/master/synapse/res/templates
|
||||
#
|
||||
#template_dir: "res/templates"
|
||||
|
||||
# Subjects to use when sending emails from Synapse.
|
||||
#
|
||||
# The placeholder '%%(app)s' will be replaced with the value of the 'app_name'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue