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

ApplicationTransactions - reload subscribers if there's a transaction that changes them

Summary: in applyExternalEffects, for subscriber transactions, we now re-load subscribers. also fixes a bug where a user can get emailed 2x when they take an action on a mock they created.

Test Plan: made some mocks. verified one copy sent to creator and one to each subscriber. (note having problems with email so I verified the phids mail was supposed to be sent to and did not get the actual email delivered)

Reviewers: epriestley, chad

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T3315

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

+25 -12
+25 -12
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 217 217 array_diff_key($new_map, $old_map))); 218 218 219 219 $subeditor->save(); 220 + 221 + // for the rest of these edits, subscribers should include those just 222 + // added as well as those just removed. 223 + $subscribers = array_unique(array_merge( 224 + $this->subscribers, 225 + $xaction->getOldValue(), 226 + $xaction->getNewValue())); 227 + $this->subscribers = $subscribers; 228 + 220 229 break; 221 230 case PhabricatorTransactions::TYPE_EDGE: 222 231 $old = $xaction->getOldValue(); ··· 307 316 308 317 $actor = $this->requireActor(); 309 318 310 - if ($object->getPHID() && 311 - ($object instanceof PhabricatorSubscribableInterface)) { 312 - $subs = PhabricatorSubscribersQuery::loadSubscribersForPHID( 313 - $object->getPHID()); 314 - $this->subscribers = array_fuse($subs); 315 - } else { 316 - $this->subscribers = array(); 317 - } 319 + $this->loadSubscribers($object); 318 320 319 321 $xactions = $this->applyImplicitCC($object, $xactions); 320 322 ··· 502 504 } 503 505 foreach ($xactions as $key => $xaction) { 504 506 $xaction->setHandles(array_select_keys($handles, $phids[$key])); 507 + } 508 + } 509 + 510 + private function loadSubscribers(PhabricatorLiskDAO $object) { 511 + if ($object->getPHID() && 512 + ($object instanceof PhabricatorSubscribableInterface)) { 513 + $subs = PhabricatorSubscribersQuery::loadSubscribersForPHID( 514 + $object->getPHID()); 515 + $this->subscribers = array_fuse($subs); 516 + } else { 517 + $this->subscribers = array(); 505 518 } 506 519 } 507 520 ··· 1017 1030 PhabricatorLiskDAO $object, 1018 1031 array $xactions) { 1019 1032 1020 - $email_to = $this->getMailTo($object); 1021 - $email_cc = $this->getMailCC($object); 1033 + $email_to = array_unique($this->getMailTo($object)); 1034 + $email_cc = array_unique($this->getMailCC($object)); 1022 1035 1023 1036 $phids = array_merge($email_to, $email_cc); 1024 1037 $handles = id(new PhabricatorObjectHandleData($phids)) ··· 1203 1216 PhabricatorLiskDAO $object, 1204 1217 array $xactions) { 1205 1218 1206 - return array_merge( 1219 + return array_unique(array_merge( 1207 1220 $this->getMailTo($object), 1208 - $this->getMailCC($object)); 1221 + $this->getMailCC($object))); 1209 1222 } 1210 1223 1211 1224