diff options
author | Malfurious <m@lfurio.us> | 2021-10-20 02:28:18 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2021-10-20 02:28:18 -0400 |
commit | 5ca9a06004fa94a1882e117da712bcbb6902291d (patch) | |
tree | 1926df2237e7e245ee8d5ed2b513299e8fe0f4c3 | |
parent | e88b153336610e18732fbcc1d8ff3ac4e653d080 (diff) | |
download | scrott-5ca9a06004fa94a1882e117da712bcbb6902291d.tar.gz scrott-5ca9a06004fa94a1882e117da712bcbb6902291d.zip |
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 <m@lfurio.us>
-rw-r--r-- | app/model/issue.php | 15 | ||||
-rw-r--r-- | 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"; <?php if ($assign->signedoff != "") { ?> <?=userPanel($assign->assignee, "alert alert-success", "signed off", $assign->signedoff)?> <?php } else { ?> - <?=userPanel($assign->assignee, "alert alert-warning", "assigned", $assign->assigned)?> + <?php $verb = ($assign->assignee == $assign->assigner ? "claimed" : "assigned"); ?> + <?=userPanel($assign->assignee, "alert alert-warning", $verb, $assign->assigned)?> <?php } ?> <?php } ?> |