Skip to content

Commit

Permalink
Also fix template URLs for plugins
Browse files Browse the repository at this point in the history
The email template path is actually different in the main plugin vs the root repo, so we need to account for that difference when building links to GitHub.
  • Loading branch information
kitsuta committed May 16, 2024
1 parent 449a300 commit b0d5123
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions uber/automated_emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,12 @@ def update_template_plugin_info(self):
env = JinjaEnv.env()
try:
template_path = pathlib.Path(env.get_or_select_template(os.path.join('emails', self.template)).filename)
self.template_plugin_name = template_path.parts[2]
path_offset = 0
if template_path.parts[2] == 'plugins':
path_offset = 2
self.template_plugin_name = template_path.parts[2 + path_offset]
self.template_url = (f"https://github.com/magfest/{self.template_plugin_name}/tree/main/"
f"{self.template_plugin_name}/{pathlib.Path(*template_path.parts[3:]).as_posix()}")
f"{self.template_plugin_name}/{pathlib.Path(*template_path.parts[(3 + path_offset):]).as_posix()}")
except jinja2.exceptions.TemplateNotFound:
self.template_plugin_name = "ERROR: TEMPLATE NOT FOUND"
self.template_url = ""
Expand Down

0 comments on commit b0d5123

Please sign in to comment.