From 5a104ed905c53fe017800c6ae79b50b9752037ba Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 23 Sep 2013 14:30:29 -0700 Subject: [PATCH] Add icons, colors and action names to Maniphest timeline view Summary: Ref T2217. These are mostly me making stuff up rather than some bird's-eye view of color and iconography across applications, yell if any of these seem off once this rolls out. Test Plan: - Looked at a bunch of transactions, saw reasonable looking colors and icons. - Sent email, saw appropriate subject line actions. Reviewers: btrahan, chad Reviewed By: chad CC: aran Maniphest Tasks: T2217 Differential Revision: https://secure.phabricator.com/D7075 --- .../storage/ManiphestTransactionPro.php | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) diff --git a/src/applications/maniphest/storage/ManiphestTransactionPro.php b/src/applications/maniphest/storage/ManiphestTransactionPro.php index 10ddcd718f..ba3b279ce5 100644 --- a/src/applications/maniphest/storage/ManiphestTransactionPro.php +++ b/src/applications/maniphest/storage/ManiphestTransactionPro.php @@ -74,6 +74,149 @@ final class ManiphestTransactionPro return $phids; } + + public function getColor() { + $old = $this->getOldValue(); + $new = $this->getNewValue(); + + switch ($this->getTransactionType()) { + case self::TYPE_STATUS: + if ($new == ManiphestTaskStatus::STATUS_OPEN) { + if ($old) { + return 'violet'; + } else { + return 'green'; + } + } else { + return 'black'; + } + + case self::TYPE_PRIORITY: + if ($old == ManiphestTaskPriority::getDefaultPriority()) { + return 'green'; + } else if ($old > $new) { + return 'grey'; + } else { + return 'yellow'; + } + + } + + return parent::getColor(); + } + + public function getActionName() { + $old = $this->getOldValue(); + $new = $this->getNewValue(); + + switch ($this->getTransactionType()) { + case self::TYPE_TITLE: + return pht('Retitled'); + + case self::TYPE_STATUS: + if ($new == ManiphestTaskStatus::STATUS_OPEN) { + if ($old) { + return pht('Reopened'); + } else { + return pht('Created'); + } + } else { + switch ($new) { + case ManiphestTaskStatus::STATUS_CLOSED_SPITE: + return pht('Spited'); + case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE: + return pht('Merged'); + default: + return pht('Closed'); + } + } + + case self::TYPE_DESCRIPTION: + return pht('Edited'); + + case self::TYPE_OWNER: + if ($this->getAuthorPHID() == $new) { + return pht('Claimed'); + } else if (!$new) { + return pht('Up For Grabs'); + } else if (!$old) { + return pht('Assigned'); + } else { + return pht('Reassigned'); + } + + case self::TYPE_CCS: + return pht('Changed CC'); + + case self::TYPE_PROJECTS: + return pht('Changed Projects'); + + case self::TYPE_PRIORITY: + if ($old == ManiphestTaskPriority::getDefaultPriority()) { + return pht('Triaged'); + } else if ($old > $new) { + return pht('Lowered Priority'); + } else { + return pht('Raised Priority'); + } + + case self::TYPE_EDGE: + case self::TYPE_ATTACH: + return pht('Attached'); + } + + return parent::getActionName(); + } + + public function getIcon() { + $old = $this->getOldValue(); + $new = $this->getNewValue(); + + switch ($this->getTransactionType()) { + case self::TYPE_TITLE: + return 'edit'; + + case self::TYPE_STATUS: + if ($new == ManiphestTaskStatus::STATUS_OPEN) { + return 'create'; + } else { + switch ($new) { + case ManiphestTaskStatus::STATUS_CLOSED_SPITE: + return 'dislike'; + case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE: + return 'delete'; + default: + return 'check'; + } + } + + case self::TYPE_DESCRIPTION: + return 'edit'; + + case self::TYPE_PROJECTS: + return 'tag'; + + case self::TYPE_PRIORITY: + if ($old == ManiphestTaskPriority::getDefaultPriority()) { + return 'start-sandcastle'; + return pht('Triaged'); + } else if ($old > $new) { + return 'download-alt'; + } else { + return 'upload'; + } + + case self::TYPE_EDGE: + case self::TYPE_ATTACH: + return 'attach'; + + } + + return parent::getIcon(); + } + + + public function getTitle() { $author_phid = $this->getAuthorPHID();