@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Avoid "Action with no effect" for auto-claim statuses after manually removing assignee

Summary:
Sometime you just want to flag something as Resolved and keep that task claimed by nobody.

But, there are some task statuses that can auto-claim, and "Resolved" is one of these.
So, if you "Resolved", Phorge tries to set yourself as claimer.

Keeping that "claimed by nobody" is a bit tricky and also generates a confusing warning.

In fact, after you "Resolved", you can override the defaults with:

- Add Action > Assign / Claim > (nobody)

The problem is, on saving, the above action causes this warning:

> **Action With No Effect**
> One of your actions has no effect:
> The task already has the selected owner.
> Apply remaining actions?
> [ Cancel ] [ Apply Remaining Actions ]

That warning "The task already has the selected owner" really means
"The task is already claimed by nobody" and, indeed, that is exactly what the user wants.

This patch intercepts the above action, and prevents the related confusing "non-effect" warning.

Thanks to hard troubleshooting from user https://we.phorge.it/p/aklapper/

See also https://we.phorge.it/D25476

Closes T15164

Test Plan:
Task 1 open unassigned:

1. Change Status to Resolved
2. Preview yourself as Claimer
3. Add Action > Assign / Claim, and **set <nothing>**
4. Save and, instead of any confusing warning, only the Status changes.

Task 2 open unassigned:

1. Change Status to Resolved
2. Preview yourself as Claimer
3. Add Action > Assign / Claim, keep it as-is
4. Save and, it works as expected (just like before)

Task 3 open unassigned:

1. Change Status to Resolved
2. Preview yourself as Claimer
3. Add Action > Assign / Claim, set to somebody else
4. Save and, it works as expected (just like before)

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15164

Differential Revision: https://we.phorge.it/D25550

+18 -11
+18 -11
src/applications/maniphest/editor/ManiphestTransactionEditor.php
··· 327 327 328 328 $is_unassigned = ($object->getOwnerPHID() === null); 329 329 330 - $any_assign = false; 330 + $any_xassign = null; 331 331 foreach ($xactions as $xaction) { 332 332 if ($xaction->getTransactionType() == 333 333 ManiphestTaskOwnerTransaction::TRANSACTIONTYPE) { 334 - $any_assign = true; 334 + $any_xassign = $xaction; 335 335 break; 336 336 } 337 337 } ··· 355 355 356 356 // If the task is not assigned, not being assigned, currently open, and 357 357 // being closed, try to assign the actor as the owner. 358 - if ($is_unassigned && !$any_assign && $is_open && $is_closing) { 359 - $is_claim = ManiphestTaskStatus::isClaimStatus($new_status); 360 - 361 - // Don't assign the actor if they aren't a real user. 362 - // Don't claim the task if the status is configured to not claim. 363 - if ($actor_phid && $is_claim) { 364 - $results[] = id(new ManiphestTransaction()) 365 - ->setTransactionType(ManiphestTaskOwnerTransaction::TRANSACTIONTYPE) 366 - ->setNewValue($actor_phid); 358 + // Don't assign the actor if they aren't a real user. 359 + if ($is_unassigned && $is_open && $is_closing && $actor_phid) { 360 + $is_autoclaim = ManiphestTaskStatus::isClaimStatus($new_status); 361 + if ($is_autoclaim) { 362 + if ($any_xassign === null) { 363 + $results[] = id(new ManiphestTransaction()) 364 + ->setTransactionType(ManiphestTaskOwnerTransaction::TRANSACTIONTYPE) 365 + ->setNewValue($actor_phid); 366 + } else if ($any_xassign->getNewValue() === null) { 367 + // We have an explicit "Assign / Claim" = nothing in the frontend. 368 + // The user is trying to "undo" the above automatic auto-claim. 369 + // When saving, this would cause the "no effect" warning. 370 + // So we suppress that confusing warning. 371 + // https://we.phorge.it/T15164 372 + $any_xassign->setIgnoreOnNoEffect(true); 373 + } 367 374 } 368 375 } 369 376