Skip to content

Commit

Permalink
Truncated assigned comments & added more context (#4329)
Browse files Browse the repository at this point in the history
Fixes #4327. Adds a little more context to an assigned comment and will
give a sample of the comment, truncating it if it goes over 2 lines.
  • Loading branch information
wes-otf authored Jan 10, 2025
1 parent 9fd3740 commit 4086c24
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hypha/apply/todo/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
template_map = {
# ADD Manual Task
COMMENT_TASK: {
"text": _("{msg}"),
"text": _(
'{related.user} assigned you a comment on [<span class="truncate inline-block max-w-32 align-bottom ">{related.source.title}</span>]({link} "{related.source.title}"):\n<span class="line-clamp-2 italic align-bottom ">{msg}</span>'
),
"icon": "comment",
"url": "{link}",
"type": _("Comment"),
Expand Down Expand Up @@ -217,7 +219,8 @@ def get_task_template(request, task, **kwargs):
"link": link_to(related_obj, request),
}
if task.code == COMMENT_TASK:
template_kwargs["msg"] = related_obj.message
# Replace all newlines with spaces
template_kwargs["msg"] = " ".join(related_obj.message.splitlines())
template["text"] = template["text"].format(**template_kwargs)
template["url"] = template["url"].format(**template_kwargs)
# additional field
Expand Down

0 comments on commit 4086c24

Please sign in to comment.