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:
Brendan Abolivier 2021-08-17 14:45:24 +02:00 committed by GitHub
parent c4cf0c0473
commit 5639759980
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 342 additions and 418 deletions

View file

@ -91,6 +91,7 @@ class ModuleApi:
self._state = hs.get_state_handler()
self._clock: Clock = hs.get_clock()
self._send_email_handler = hs.get_send_email_handler()
self.custom_template_dir = hs.config.server.custom_template_directory
try:
app_name = self._hs.config.email_app_name
@ -679,7 +680,7 @@ class ModuleApi:
"""
return self._hs.config.read_templates(
filenames,
(td for td in (custom_template_directory,) if td),
(td for td in (self.custom_template_dir, custom_template_directory) if td),
)