diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 8bb0db6cf6..b563d1ae89 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -704,7 +704,6 @@ phutil_register_library_map(array( 'LiskIsolationTestDAOException' => 'infrastructure/storage/lisk/__tests__/LiskIsolationTestDAOException.php', 'LiskMigrationIterator' => 'infrastructure/storage/lisk/LiskMigrationIterator.php', 'LiskRawMigrationIterator' => 'infrastructure/storage/lisk/LiskRawMigrationIterator.php', - 'ManiphestAction' => 'applications/maniphest/constants/ManiphestAction.php', 'ManiphestBatchEditController' => 'applications/maniphest/controller/ManiphestBatchEditController.php', 'ManiphestCapabilityDefaultEdit' => 'applications/maniphest/capability/ManiphestCapabilityDefaultEdit.php', 'ManiphestCapabilityDefaultView' => 'applications/maniphest/capability/ManiphestCapabilityDefaultView.php', @@ -1197,7 +1196,6 @@ phutil_register_library_map(array( 'PhabricatorFeedStoryData' => 'applications/feed/storage/PhabricatorFeedStoryData.php', 'PhabricatorFeedStoryDifferential' => 'applications/feed/story/PhabricatorFeedStoryDifferential.php', 'PhabricatorFeedStoryDifferentialAggregate' => 'applications/feed/story/PhabricatorFeedStoryDifferentialAggregate.php', - 'PhabricatorFeedStoryManiphest' => 'applications/feed/story/PhabricatorFeedStoryManiphest.php', 'PhabricatorFeedStoryManiphestAggregate' => 'applications/feed/story/PhabricatorFeedStoryManiphestAggregate.php', 'PhabricatorFeedStoryNotification' => 'applications/notification/storage/PhabricatorFeedStoryNotification.php', 'PhabricatorFeedStoryPhriction' => 'applications/feed/story/PhabricatorFeedStoryPhriction.php', @@ -2839,7 +2837,6 @@ phutil_register_library_map(array( 'LiskIsolationTestDAOException' => 'Exception', 'LiskMigrationIterator' => 'PhutilBufferedIterator', 'LiskRawMigrationIterator' => 'PhutilBufferedIterator', - 'ManiphestAction' => 'ManiphestConstants', 'ManiphestBatchEditController' => 'ManiphestController', 'ManiphestCapabilityDefaultEdit' => 'PhabricatorPolicyCapability', 'ManiphestCapabilityDefaultView' => 'PhabricatorPolicyCapability', @@ -3381,7 +3378,6 @@ phutil_register_library_map(array( 'PhabricatorFeedStoryData' => 'PhabricatorFeedDAO', 'PhabricatorFeedStoryDifferential' => 'PhabricatorFeedStory', 'PhabricatorFeedStoryDifferentialAggregate' => 'PhabricatorFeedStoryAggregate', - 'PhabricatorFeedStoryManiphest' => 'PhabricatorFeedStory', 'PhabricatorFeedStoryManiphestAggregate' => 'PhabricatorFeedStoryAggregate', 'PhabricatorFeedStoryNotification' => 'PhabricatorFeedDAO', 'PhabricatorFeedStoryPhriction' => 'PhabricatorFeedStory', diff --git a/src/applications/feed/story/PhabricatorFeedStoryManiphest.php b/src/applications/feed/story/PhabricatorFeedStoryManiphest.php deleted file mode 100644 index 7967e8a655..0000000000 --- a/src/applications/feed/story/PhabricatorFeedStoryManiphest.php +++ /dev/null @@ -1,143 +0,0 @@ -getValue('taskPHID'); - } - - public function getRequiredHandlePHIDs() { - return array( - $this->getValue('ownerPHID'), - ); - } - - public function renderView() { - $data = $this->getStoryData(); - - $view = $this->newStoryView(); - $view->setAppIcon('maniphest-dark'); - - $line = $this->getLineForData($data); - $view->setTitle($line); - - $action = $data->getValue('action'); - - $view->setImage($this->getHandle($data->getAuthorPHID())->getImageURI()); - - switch ($action) { - case ManiphestAction::ACTION_COMMENT: - // I'm just fetching the comments here - // Don't repeat this at home! - $comments = $data->getValue('comments'); - $content = $this->renderSummary($comments); - $view->appendChild($content); - break; - case ManiphestAction::ACTION_CREATE: - $content = $this->renderSummary($data->getValue('description')); - $view->appendChild($content); - break; - } - - $href = $this->getHandle($data->getValue('taskPHID'))->getURI(); - $view->setHref($href); - - return $view; - } - - private function getLineForData($data) { - $action = $data->getValue('action'); - - $actor_phid = $data->getAuthorPHID(); - $actor_link = $this->linkTo($actor_phid); - - $task_phid = $data->getValue('taskPHID'); - $task_link = $this->linkTo($task_phid); - - $owner_phid = $data->getValue('ownerPHID'); - $owner_link = $this->linkTo($owner_phid); - - $verb = ManiphestAction::getActionPastTenseVerb($action); - - switch ($action) { - case ManiphestAction::ACTION_ASSIGN: - case ManiphestAction::ACTION_REASSIGN: - if ($owner_phid) { - if ($owner_phid == $actor_phid) { - $one_line = hsprintf('%s claimed %s', $actor_link, $task_link); - } else { - $one_line = hsprintf('%s %s %s to %s', - $actor_link, - $verb, - $owner_link, - $task_link); - } - } else { - $one_line = hsprintf( - '%s placed %s up for grabs', - $actor_link, - $task_link); - } - break; - default: - $one_line = hsprintf('%s %s %s', $actor_link, $verb, $task_link); - break; - } - - return $one_line; - } - - public function renderText() { - $actor_phid = $this->getAuthorPHID(); - $author_name = $this->getHandle($actor_phid)->getLinkName(); - - $owner_phid = $this->getValue('ownerPHID'); - $owner_name = $this->getHandle($owner_phid)->getLinkName(); - - $task_phid = $this->getPrimaryObjectPHID(); - $task_handle = $this->getHandle($task_phid); - $task_title = $task_handle->getLinkName(); - $task_uri = PhabricatorEnv::getURI($task_handle->getURI()); - - $action = $this->getValue('action'); - $verb = ManiphestAction::getActionPastTenseVerb($action); - - switch ($action) { - case ManiphestAction::ACTION_ASSIGN: - case ManiphestAction::ACTION_REASSIGN: - if ($owner_phid) { - if ($owner_phid == $actor_phid) { - $text = "{$author_name} claimed {$task_title}"; - } else { - $text = "{$author_name} {$verb} {$task_title} to {$owner_name}"; - } - } else { - $text = "{$author_name} placed {$task_title} up for grabs"; - } - break; - default: - $text = "{$author_name} {$verb} {$task_title}"; - break; - } - - $text .= " {$task_uri}"; - - return $text; - } - - public function getNotificationAggregations() { - $class = get_class($this); - $phid = $this->getStoryData()->getValue('taskPHID'); - $read = (int)$this->getHasViewed(); - - // Don't aggregate updates separated by more than 2 hours. - $block = (int)($this->getEpoch() / (60 * 60 * 2)); - - return array( - "{$class}:{$phid}:{$read}:{$block}" - => 'PhabricatorFeedStoryManiphestAggregate', - ); - } - -} diff --git a/src/applications/maniphest/constants/ManiphestAction.php b/src/applications/maniphest/constants/ManiphestAction.php deleted file mode 100644 index f45a47088a..0000000000 --- a/src/applications/maniphest/constants/ManiphestAction.php +++ /dev/null @@ -1,86 +0,0 @@ - 'created', - self::ACTION_CLOSE => 'closed', - self::ACTION_UPDATE => 'updated', - self::ACTION_ASSIGN => 'assigned', - self::ACTION_REASSIGN => 'reassigned', - self::ACTION_COMMENT => 'commented on', - self::ACTION_CC => 'updated cc\'s of', - self::ACTION_PRIORITY => 'changed the priority of', - self::ACTION_PROJECT => 'modified projects of', - self::ACTION_TITLE => 'updated title of', - self::ACTION_DESCRIPTION => 'updated description of', - self::ACTION_ATTACH => 'attached something to', - self::ACTION_EDGE => 'changed related objects of', - self::ACTION_REOPEN => 'reopened', - self::ACTION_AUXILIARY => 'updated an auxiliary field of', - ); - - return idx($map, $action, "brazenly {$action}'d"); - } - - /** - * If a group of transactions contain several actions, select the "strongest" - * action. For instance, a close is stronger than an update, because we want - * to render "User U closed task T" instead of "User U updated task T" when - * a user closes a task. - */ - public static function selectStrongestAction(array $actions) { - static $strengths = array( - self::ACTION_AUXILIARY => -1, - self::ACTION_UPDATE => 0, - self::ACTION_CC => 1, - self::ACTION_PROJECT => 2, - self::ACTION_DESCRIPTION => 3, - self::ACTION_TITLE => 4, - self::ACTION_ATTACH => 5, - self::ACTION_EDGE => 5, - self::ACTION_COMMENT => 6, - self::ACTION_PRIORITY => 7, - self::ACTION_REASSIGN => 8, - self::ACTION_ASSIGN => 9, - self::ACTION_REOPEN => 10, - self::ACTION_CREATE => 11, - self::ACTION_CLOSE => 12, - ); - - $strongest = null; - $strength = -1; - foreach ($actions as $action) { - if ($strengths[$action] > $strength) { - $strength = $strengths[$action]; - $strongest = $action; - } - } - return $strongest; - } - -}