Skip to content

Commit 4086c24

Browse files
authored
Truncated assigned comments & added more context (#4329)
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.
1 parent 9fd3740 commit 4086c24

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

hypha/apply/todo/options.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
template_map = {
5151
# ADD Manual Task
5252
COMMENT_TASK: {
53-
"text": _("{msg}"),
53+
"text": _(
54+
'{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>'
55+
),
5456
"icon": "comment",
5557
"url": "{link}",
5658
"type": _("Comment"),
@@ -217,7 +219,8 @@ def get_task_template(request, task, **kwargs):
217219
"link": link_to(related_obj, request),
218220
}
219221
if task.code == COMMENT_TASK:
220-
template_kwargs["msg"] = related_obj.message
222+
# Replace all newlines with spaces
223+
template_kwargs["msg"] = " ".join(related_obj.message.splitlines())
221224
template["text"] = template["text"].format(**template_kwargs)
222225
template["url"] = template["url"].format(**template_kwargs)
223226
# additional field

0 commit comments

Comments
 (0)