@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.

Don't raise the "Subscribers Won't Be Notified" draft warning if you aren't adding any non-you subscribers

Summary:
Currently, adding subscribers to a draft revision raises a warning that they won't get an email/notification.

This warning has some false positives:

- it triggers on any subscriber change, including removing subscribers; and
- it triggers if you're only adding yourself as a subscriber.

Narrow the scope of the warning so it is raised only if you're adding a subscriber other than yourself.

Test Plan:
- Added a non-self subscriber, got the warning as before.
- Added self as a subscriber, no warning (previously: warning).
- Removed a subscriber, no warning (previously: warning).

Differential Revision: https://secure.phabricator.com/D21402

+16 -4
+16 -4
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 4968 4968 4969 4969 private function hasWarnings($object, $xaction) { 4970 4970 // TODO: For the moment, this is a very un-modular hack to support 4971 - // exactly one type of warning (mentioning users on a draft revision) 4972 - // that we want to show. See PHI433. 4971 + // a small number of warnings related to draft revisions. See PHI433. 4973 4972 4974 4973 if (!($object instanceof DifferentialRevision)) { 4975 4974 return false; ··· 4991 4990 return false; 4992 4991 } 4993 4992 4994 - // NOTE: This will currently warn even if you're only removing 4995 - // subscribers. 4993 + // We're only going to raise a warning if the transaction adds subscribers 4994 + // other than the acting user. (This implementation is clumsy because the 4995 + // code runs before a lot of normalization occurs.) 4996 + 4997 + $old = $this->getTransactionOldValue($object, $xaction); 4998 + $new = $this->getPHIDTransactionNewValue($xaction, $old); 4999 + $old = array_fuse($old); 5000 + $new = array_fuse($new); 5001 + $add = array_diff_key($new, $old); 5002 + 5003 + unset($add[$this->getActingAsPHID()]); 5004 + 5005 + if (!$add) { 5006 + return false; 5007 + } 4996 5008 4997 5009 return true; 4998 5010 }