Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Improve customizability and consistency of templates #7280

Closed
3 of 4 tasks
clokep opened this issue Apr 15, 2020 · 12 comments
Closed
3 of 4 tasks

Improve customizability and consistency of templates #7280

clokep opened this issue Apr 15, 2020 · 12 comments
Labels
T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. z-p3 (Deprecated Label)

Comments

@clokep
Copy link
Member

clokep commented Apr 15, 2020

Some new templates were added recently that dealt with SSO (#7102, #7240, #7279, #7067), but I think this is a wider issue.

There's a few oddities with the templates used in Synapse:

  • Some are hard-coded HTML embedded in Python (this is non-ideal due to no syntax highlighting in editors, etc as well as not being customizable).
  • Some "templates" are loaded as raw HTML files, but some are treated as Jinja2. (Note also that some of those are loaded during the configuration step, while some are loaded while handlers are initialized.)
  • There's a variety of template directories that must be configured: account_validity, saml2_config, sso, email, user_consent.
  • Some of those template directories also allow you to customize the names of templates, while others use hard-coded names (e.g. the account_renewed_html_path setting vs. SSO uses hard-coded names).

I think there's a few concrete things we could do to improve this situation:

@richvdh
Copy link
Member

richvdh commented Apr 16, 2020

Some of those template directories also allow you to customize the names of templates, while others use hard-coded names (e.g. the account_renewed_html_path setting vs. SSO uses hard-coded names).

I think the settings that allow you to customise the template names are now deprecated?

@babolivier
Copy link
Contributor

I'm not aware of deprecation for account_renewed_html_path, but it should probably be deprecated.

@clokep
Copy link
Member Author

clokep commented Apr 16, 2020

I think the settings that allow you to customise the template names are now deprecated?

Then this would be a good opportunity to clean them up! 😄

anoadragon453 pushed a commit that referenced this issue Oct 2, 2020
This converts a few more of our inline HTML templates to Jinja. This is somewhat part of #7280 and should make it a bit easier to customize these in the future.
@clokep
Copy link
Member Author

clokep commented Oct 2, 2020

Another idea, per #8444 (comment):

I don't know if it's worth renaming the templates to indicate that they're not pure HTML - e.g. ansible community seems to have gravitated towards ".html.j2" for something that needs templating before it's usable.

@richvdh
Copy link
Member

richvdh commented Dec 7, 2020

on a related but somewhat tangential note, there are also some static files in https://github.com/matrix-org/synapse/tree/master/synapse/static, whose content or styling might want customising too. It would be nice to give the admin the option to do so.

@clokep
Copy link
Member Author

clokep commented Dec 7, 2020

This was solved in #8444.

  • Some "templates" are loaded as raw HTML files, but some are treated as Jinja2. (Note also that some of those are loaded during the configuration step, while some are loaded while handlers are initialized.)

This was solved in #8037.

@reivilibre
Copy link
Contributor

Another idea, per #8444 (comment):

I don't know if it's worth renaming the templates to indicate that they're not pure HTML - e.g. ansible community seems to have gravitated towards ".html.j2" for something that needs templating before it's usable.

at least Kate (KDE's Advanced Text Editor) understands .html.j2 and offers highlighting for both HTML and Jinja2 at once, so use of this extension seems like a win to me

@babolivier
Copy link
Contributor

babolivier commented Aug 16, 2021

#10596 consolidates all custom template directories into one.

Edit: it has been merged, and support for legacy template directories is scheduled to be removed in October.

@erikjohnston erikjohnston added T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. and removed z-feature (Deprecated Label) labels Aug 23, 2021
@richvdh
Copy link
Member

richvdh commented Sep 1, 2021

Is this now, basically, done? We could remove the deprecated "pick a template name" options but generally I feel like they are fairly harmless?

@richvdh
Copy link
Member

richvdh commented Sep 1, 2021

support for legacy template directories is scheduled to be removed in October.

opened #10735 to track this

@clokep
Copy link
Member Author

clokep commented Sep 1, 2021

Is this now, basically, done? We could remove the deprecated "pick a template name" options but generally I feel like they are fairly harmless?

I think that's all that's remaining, yes!

I do find less having fewer config options a good goal, but I'm not sure that's worth it in this case.

@richvdh
Copy link
Member

richvdh commented Sep 2, 2021

alright, I'm going to close this then.

@richvdh richvdh closed this as completed Sep 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. z-p3 (Deprecated Label)
Projects
None yet
Development

No branches or pull requests

5 participants