Page MenuHomePhorge

D25476.1734657305.diff
No OneTemporary

D25476.1734657305.diff

diff --git a/src/applications/maniphest/editor/ManiphestTransactionEditor.php b/src/applications/maniphest/editor/ManiphestTransactionEditor.php
--- a/src/applications/maniphest/editor/ManiphestTransactionEditor.php
+++ b/src/applications/maniphest/editor/ManiphestTransactionEditor.php
@@ -328,10 +328,12 @@
$is_unassigned = ($object->getOwnerPHID() === null);
$any_assign = false;
+ $new_assignee = null;
foreach ($xactions as $xaction) {
if ($xaction->getTransactionType() ==
ManiphestTaskOwnerTransaction::TRANSACTIONTYPE) {
$any_assign = true;
+ $new_assignee = $xaction->getNewValue();
break;
}
}
@@ -353,17 +355,38 @@
$is_closing = ManiphestTaskStatus::isClosedStatus($new_status);
}
- // If the task is not assigned, not being assigned, currently open, and
- // being closed, try to assign the actor as the owner.
- if ($is_unassigned && !$any_assign && $is_open && $is_closing) {
- $is_claim = ManiphestTaskStatus::isClaimStatus($new_status);
+ // Check if status is configured to claim (silently set actor as owner).
+ $is_claim = ManiphestTaskStatus::isClaimStatus($new_status);
- // Don't assign the actor if they aren't a real user.
- // Don't claim the task if the status is configured to not claim.
- if ($actor_phid && $is_claim) {
- $results[] = id(new ManiphestTransaction())
- ->setTransactionType(ManiphestTaskOwnerTransaction::TRANSACTIONTYPE)
- ->setNewValue($actor_phid);
+ // Check if the task is not assigned, currently open, and being closed.
+ if ($is_unassigned && $is_open && $is_closing) {
+
+ // If the task is not being assigned, try to assign the actor as owner.
+ if (!$any_assign) {
+ // Assign the actor only if they are a real user.
+ // Claim the task only if the status is configured to claim.
+ if ($actor_phid && $is_claim) {
+ $results[] = id(new ManiphestTransaction())
+ ->setTransactionType(ManiphestTaskOwnerTransaction::TRANSACTIONTYPE)
+ ->setNewValue($actor_phid);
+ }
+ }
+
+ // If the actor is going to set a status configured to claim && the actor
+ // has opened "Add Field... > Assigned To" (so $any_assign is true) && the
+ // actor has removed themselves from "Assigned To" (so $new_assignee is
+ // null), we de-facto are not going to change the (empty) assignee anyway.
+ // Thus remove the reassign transaction from $results to avoid the
+ // unwanted "Action with no effect" dialog. - https://we.phorge.it/T15164
+ if ($any_assign && $is_claim && !$new_assignee) {
+ for ($i = 0; $i < count($results); $i++) {
+ if ($results[$i]->getTransactionType() ===
+ ManiphestTaskOwnerTransaction::TRANSACTIONTYPE) {
+ unset($results[$i]);
+ $results = array_values($results); // close gap
+ break;
+ }
+ }
}
}

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 01:15 (18 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1016314
Default Alt Text
D25476.1734657305.diff (2 KB)

Event Timeline