mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 16:22:43 +01:00
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
This commit is contained in:
parent
9c999e3548
commit
aa8c661d5d
4 changed files with 38 additions and 9 deletions
|
@ -9,14 +9,17 @@ final class DifferentialDoorkeeperRevisionFeedStoryPublisher
|
|||
|
||||
public function isStoryAboutObjectCreation($object) {
|
||||
$story = $this->getFeedStory();
|
||||
|
||||
$action = $story->getStoryData()->getValue('action');
|
||||
switch ($action) {
|
||||
case DifferentialAction::ACTION_CREATE:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
return ($action == DifferentialAction::ACTION_CREATE);
|
||||
}
|
||||
|
||||
public function isStoryAboutObjectClosure($object) {
|
||||
$story = $this->getFeedStory();
|
||||
$action = $story->getStoryData()->getValue('action');
|
||||
|
||||
return ($action == DifferentialAction::ACTION_CLOSE) ||
|
||||
($action == DifferentialAction::ACTION_ABANDON);
|
||||
}
|
||||
|
||||
public function willPublishStory($object) {
|
||||
|
|
|
@ -22,6 +22,29 @@ final class DiffusionDoorkeeperCommitFeedStoryPublisher
|
|||
return false;
|
||||
}
|
||||
|
||||
public function isStoryAboutObjectClosure($object) {
|
||||
// TODO: This isn't quite accurate, but pretty close: check if this story
|
||||
// is a close (which clearly is about object closure) or is an "Accept" and
|
||||
// the commit is fully audited (which is almost certainly a closure).
|
||||
// After ApplicationTransactions, we could annotate feed stories more
|
||||
// explicitly.
|
||||
|
||||
$story = $this->getFeedStory();
|
||||
$action = $story->getStoryData()->getValue('action');
|
||||
|
||||
if ($action == PhabricatorAuditActionConstants::CLOSE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$fully_audited = PhabricatorAuditCommitStatusConstants::FULLY_AUDITED;
|
||||
if (($action == PhabricatorAuditActionConstants::ACCEPT) &&
|
||||
$object->getAuditStatus() == $fully_audited) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function willPublishStory($commit) {
|
||||
$requests = id(new PhabricatorAuditQuery())
|
||||
->withCommitPHIDs(array($commit->getPHID()))
|
||||
|
|
|
@ -36,6 +36,7 @@ abstract class DoorkeeperFeedStoryPublisher {
|
|||
}
|
||||
|
||||
abstract public function isStoryAboutObjectCreation($object);
|
||||
abstract public function isStoryAboutObjectClosure($object);
|
||||
abstract public function getOwnerPHID($object);
|
||||
abstract public function getActiveUserPHIDs($object);
|
||||
abstract public function getPassiveUserPHIDs($object);
|
||||
|
|
|
@ -478,8 +478,10 @@ final class DoorkeeperFeedWorkerAsana extends FeedPushWorker {
|
|||
|
||||
// Don't publish the "create" story, since pushing the object into Asana
|
||||
// naturally generates a notification which effectively serves the same
|
||||
// purpose as the "create" story.
|
||||
if (!$publisher->isStoryAboutObjectCreation($object)) {
|
||||
// purpose as the "create" story. Similarly, "close" stories generate a
|
||||
// close notification.
|
||||
if (!$publisher->isStoryAboutObjectCreation($object) &&
|
||||
!$publisher->isStoryAboutObjectClosure($object)) {
|
||||
// Post the feed story itself to the main Asana task. We do this last
|
||||
// because everything else is idempotent, so this is the only effect we
|
||||
// can't safely run more than once.
|
||||
|
|
Loading…
Reference in a new issue