Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs in web title and message templates rendering and visual representation #1747

Merged
merged 17 commits into from
May 2, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'dev' into iskhakov/refactor-templates
iskhakov authored Apr 25, 2023

Verified

This commit was signed with the committer’s verified signature.
rezkiy37 Michael (Mykhailo) Kravchenko
commit 40491a1ea172c1ddcc10826143b5d43bc84e7013
Original file line number Diff line number Diff line change
@@ -179,21 +179,21 @@ def _render_attribute_with_template(self, attr, data, channel, templated_alert):
# Hardcoding, as AlertWebTemplater.RENDER_FOR_WEB cause circular import
render_for_web = "web"
# Propagate rendered web templates to the other templates
added_context = {}
if self._render_for() != render_for_web:
added_context = {
"web_title": apply_jinja_template(
self.template_manager.get_attr_template("title", channel, render_for_web),
data,
result_length_limit=settings.JINJA_RESULT_TITLE_MAX_LENGTH,
**context,
),
"web_message": apply_jinja_template(
self.template_manager.get_attr_template("message", channel, render_for_web), data, **context
),
"web_image_url": apply_jinja_template(
self.template_manager.get_attr_template("image_url", channel, render_for_web), data, **context
),
}
for attr in ["title", "message", "image_url"]:
added_attr_template = self.template_manager.get_attr_template(attr, channel, render_for_web)
if added_attr_template is not None:
result_length_limit = (
settings.JINJA_RESULT_TITLE_MAX_LENGTH
if attr == "title"
else settings.JINJA_RESULT_MAX_LENGTH
)
added_context[f"web_{attr}"] = apply_jinja_template(
added_attr_template, data, result_length_limit=result_length_limit, **context
)
else:
added_context[f"web_{attr}"] = f"web_{attr} is not set"
context = {**context, **added_context}

try:
You are viewing a condensed version of this merge commit. You can view the full changes here.