@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 publish story text for "close" stories to Asana

Summary: Ref T2852. After some discussion, Asana doesn't want "close" stories either.

Test Plan: Used `bin/feed republish` to publish close and non-close stories from Differential and Diffusion. Verified comments were synchronized in the expected cases.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2852

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

+37 -8
+9 -6
src/applications/differential/doorkeeper/DifferentialDoorkeeperRevisionFeedStoryPublisher.php
··· 9 9 10 10 public function isStoryAboutObjectCreation($object) { 11 11 $story = $this->getFeedStory(); 12 + $action = $story->getStoryData()->getValue('action'); 13 + 14 + return ($action == DifferentialAction::ACTION_CREATE); 15 + } 12 16 17 + public function isStoryAboutObjectClosure($object) { 18 + $story = $this->getFeedStory(); 13 19 $action = $story->getStoryData()->getValue('action'); 14 - switch ($action) { 15 - case DifferentialAction::ACTION_CREATE: 16 - return true; 17 - default: 18 - return false; 19 - } 20 + 21 + return ($action == DifferentialAction::ACTION_CLOSE) || 22 + ($action == DifferentialAction::ACTION_ABANDON); 20 23 } 21 24 22 25 public function willPublishStory($object) {
+23
src/applications/diffusion/doorkeeper/DiffusionDoorkeeperCommitFeedStoryPublisher.php
··· 22 22 return false; 23 23 } 24 24 25 + public function isStoryAboutObjectClosure($object) { 26 + // TODO: This isn't quite accurate, but pretty close: check if this story 27 + // is a close (which clearly is about object closure) or is an "Accept" and 28 + // the commit is fully audited (which is almost certainly a closure). 29 + // After ApplicationTransactions, we could annotate feed stories more 30 + // explicitly. 31 + 32 + $story = $this->getFeedStory(); 33 + $action = $story->getStoryData()->getValue('action'); 34 + 35 + if ($action == PhabricatorAuditActionConstants::CLOSE) { 36 + return true; 37 + } 38 + 39 + $fully_audited = PhabricatorAuditCommitStatusConstants::FULLY_AUDITED; 40 + if (($action == PhabricatorAuditActionConstants::ACCEPT) && 41 + $object->getAuditStatus() == $fully_audited) { 42 + return true; 43 + } 44 + 45 + return false; 46 + } 47 + 25 48 public function willPublishStory($commit) { 26 49 $requests = id(new PhabricatorAuditQuery()) 27 50 ->withCommitPHIDs(array($commit->getPHID()))
+1
src/applications/doorkeeper/engine/DoorkeeperFeedStoryPublisher.php
··· 36 36 } 37 37 38 38 abstract public function isStoryAboutObjectCreation($object); 39 + abstract public function isStoryAboutObjectClosure($object); 39 40 abstract public function getOwnerPHID($object); 40 41 abstract public function getActiveUserPHIDs($object); 41 42 abstract public function getPassiveUserPHIDs($object);
+4 -2
src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php
··· 478 478 479 479 // Don't publish the "create" story, since pushing the object into Asana 480 480 // naturally generates a notification which effectively serves the same 481 - // purpose as the "create" story. 482 - if (!$publisher->isStoryAboutObjectCreation($object)) { 481 + // purpose as the "create" story. Similarly, "close" stories generate a 482 + // close notification. 483 + if (!$publisher->isStoryAboutObjectCreation($object) && 484 + !$publisher->isStoryAboutObjectClosure($object)) { 483 485 // Post the feed story itself to the main Asana task. We do this last 484 486 // because everything else is idempotent, so this is the only effect we 485 487 // can't safely run more than once.