From 5ca9a06004fa94a1882e117da712bcbb6902291d Mon Sep 17 00:00:00 2001 From: Malfurious Date: Wed, 20 Oct 2021 02:28:18 -0400 Subject: Recognize self-assignment within the issue UI As a special case, self-assignment is refered to as claiming assignment of an issue. The assignee list on the issue sidebar will now properly identify users which have assigned themselves, and the issue event log will now contain "Bob claimed" instead of "Bob assigned Bob" when such an event occurs in the future. Signed-off-by: Malfurious --- app/model/issue.php | 15 ++++++++++----- app/view/issue.php | 3 ++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/model/issue.php b/app/model/issue.php index c3423f7..76ae9a9 100644 --- a/app/model/issue.php +++ b/app/model/issue.php @@ -85,12 +85,17 @@ if (isAction("iss-mesg-add")) } $assignee = new user($form->assignee); - $stat = $issue->addAssignee($assignee, $user); - if (!$stat) - logError(ERROR, "Failed to assign issue"); - else - $log = mesg::initNewLog("%s assigned " . $assignee->getDisplayName(), $user, $issue); + if (!$assignee->isAssignedTo($issue)) + { + $stat = $issue->addAssignee($assignee, $user); + $mesg = ($assignee->guid == $user->guid ? "%s claimed" : "%s assigned " . $assignee->getDisplayName()); + + if (!$stat) + logError(ERROR, "Failed to assign issue"); + else + $log = mesg::initNewLog($mesg, $user, $issue); + } } else if (isset(input()['closeIssue'])) diff --git a/app/view/issue.php b/app/view/issue.php index fbd180a..9c4d77c 100644 --- a/app/view/issue.php +++ b/app/view/issue.php @@ -198,7 +198,8 @@ require_once "class/issue.class.php"; signedoff != "") { ?> assignee, "alert alert-success", "signed off", $assign->signedoff)?> - assignee, "alert alert-warning", "assigned", $assign->assigned)?> + assignee == $assign->assigner ? "claimed" : "assigned"); ?> + assignee, "alert alert-warning", $verb, $assign->assigned)?> -- cgit v1.2.3