fix: self-assignment notification to use "themselves" instead of repeating username (#1836)

When a user assigns a task to themselves, notifications to other users now
correctly say "User A assigned Task #123 to themselves" instead of
"User A assigned Task #123 to User A"

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kolaente <13721712+kolaente@users.noreply.github.com>
This commit is contained in:
Copilot
2025-11-17 23:07:48 +00:00
committed by GitHub
parent d5a46310a7
commit 5f795bb531
2 changed files with 11 additions and 1 deletions

View File

@@ -79,7 +79,9 @@
"subject_to_assignee": "You have been assigned to \"%[1]s\" (%[2]s)",
"message_to_assignee": "%[1]s has assigned you to \"%[2]s\".",
"subject_to_others": "\"%[1]s\" (%[2]s) has been assigned to %[3]s",
"message_to_others": "%[1]s has assigned this task to %[2]s."
"message_to_others": "%[1]s has assigned this task to %[2]s.",
"subject_to_others_self": "\"%[1]s\" (%[2]s) has been assigned by %[3]s to themselves",
"message_to_others_self": "%[1]s has assigned this task to themselves."
},
"deleted": {
"subject": "\"%[1]s\" (%[2]s) has been deleted",

View File

@@ -142,6 +142,14 @@ func (n *TaskAssignedNotification) ToMail(lang string) *notifications.Mail {
Action(i18n.T(lang, "notifications.common.actions.open_task"), n.Task.GetFrontendURL())
}
// Check if the doer assigned the task to themselves
if n.Doer.ID == n.Assignee.ID {
return notifications.NewMail().
Subject(i18n.T(lang, "notifications.task.assigned.subject_to_others_self", n.Task.Title, n.Task.GetFullIdentifier(), n.Doer.GetName())).
Line(i18n.T(lang, "notifications.task.assigned.message_to_others_self", n.Doer.GetName())).
Action(i18n.T(lang, "notifications.common.actions.open_task"), n.Task.GetFrontendURL())
}
return notifications.NewMail().
Subject(i18n.T(lang, "notifications.task.assigned.subject_to_others", n.Task.Title, n.Task.GetFullIdentifier(), n.Assignee.GetName())).
Line(i18n.T(lang, "notifications.task.assigned.message_to_others", n.Doer.GetName(), n.Assignee.GetName())).