1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-25 06:50:55 +01:00

Provide transaction strings, icons and colors for Differential

Summary: Ref T2222. Once these are live, yell if any of them seem off. I tried to mostly stay consistent-ish with what we had before.

Test Plan: Looked at a bunch of revisions and saw more detailed, colorful transactions.

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T2222

Differential Revision: https://secure.phabricator.com/D8223
This commit is contained in:
epriestley 2014-02-13 15:35:44 -08:00
parent cb20205aee
commit 9afe52de51

View file

@ -20,6 +20,7 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
public function getTitle() { public function getTitle() {
$author_phid = $this->getAuthorPHID(); $author_phid = $this->getAuthorPHID();
$author_handle = $this->renderHandleLink($author_phid);
$old = $this->getOldValue(); $old = $this->getOldValue();
$new = $this->getNewValue(); $new = $this->getNewValue();
@ -28,10 +29,90 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
case self::TYPE_INLINE: case self::TYPE_INLINE:
return pht( return pht(
'%s added inline comments.', '%s added inline comments.',
$this->renderHandleLink($author_phid)); $author_handle);
case self::TYPE_UPDATE:
if ($new) {
// TODO: Migrate to PHIDs and use handles here?
// TODO: Link this?
return pht(
'%s updated this revision to Diff #%d.',
$author_handle,
$new);
} else {
return pht(
'%s updated this revision.',
$author_handle);
}
case self::TYPE_ACTION:
return DifferentialAction::getBasicStoryText($new, $author_handle);
} }
return parent::getTitle(); return parent::getTitle();
} }
public function getIcon() {
switch ($this->getTransactionType()) {
case self::TYPE_INLINE:
return 'comment';
case self::TYPE_UPDATE:
return 'refresh';
case self::TYPE_ACTION:
switch ($this->getNewValue()) {
case DifferentialAction::ACTION_CLOSE:
return 'ok';
case DifferentialAction::ACTION_ACCEPT:
return 'enable';
case DifferentialAction::ACTION_REJECT:
case DifferentialAction::ACTION_ABANDON:
return 'delete';
case DifferentialAction::ACTION_RETHINK:
return 'disable';
case DifferentialAction::ACTION_REQUEST:
return 'refresh';
case DifferentialAction::ACTION_RECLAIM:
case DifferentialAction::ACTION_REOPEN:
return 'new';
case DifferentialAction::ACTION_RESIGN:
return 'undo';
case DifferentialAction::ACTION_CLAIM:
return 'user';
}
}
return parent::getIcon();
}
public function getColor() {
switch ($this->getTransactionType()) {
case self::TYPE_UPDATE:
return PhabricatorTransactions::COLOR_SKY;
case self::TYPE_ACTION:
switch ($this->getNewValue()) {
case DifferentialAction::ACTION_CLOSE:
return PhabricatorTransactions::COLOR_BLUE;
case DifferentialAction::ACTION_ACCEPT:
return PhabricatorTransactions::COLOR_GREEN;
case DifferentialAction::ACTION_REJECT:
return PhabricatorTransactions::COLOR_RED;
case DifferentialAction::ACTION_ABANDON:
return PhabricatorTransactions::COLOR_BLACK;
case DifferentialAction::ACTION_RETHINK:
return PhabricatorTransactions::COLOR_RED;
case DifferentialAction::ACTION_REQUEST:
return PhabricatorTransactions::COLOR_SKY;
case DifferentialAction::ACTION_RECLAIM:
return PhabricatorTransactions::COLOR_SKY;
case DifferentialAction::ACTION_REOPEN:
return PhabricatorTransactions::COLOR_SKY;
case DifferentialAction::ACTION_RESIGN:
return PhabricatorTransactions::COLOR_ORANGE;
case DifferentialAction::ACTION_CLAIM:
return PhabricatorTransactions::COLOR_YELLOW;
}
}
return parent::getColor();
}
} }