1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-20 10:48:40 +01:00
phorge-phorge/src/applications/project/xaction/PhabricatorProjectIconTransaction.php
Austin McKinley 1bff5309e6 Migrate Project icons to modular transactions
Test Plan: Unit tests pass. Changed some icons, observed expected timeline entries.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D17956
2017-05-18 16:25:59 -07:00

42 lines
987 B
PHP

<?php
final class PhabricatorProjectIconTransaction
extends PhabricatorProjectTransactionType {
const TRANSACTIONTYPE = 'project:icon';
public function generateOldValue($object) {
return $object->getIcon();
}
public function applyInternalEffects($object, $value) {
$object->setIcon($value);
}
public function getTitle() {
$set = new PhabricatorProjectIconSet();
$new = $this->getNewValue();
return pht(
"%s set this project's icon to %s.",
$this->renderAuthor(),
$this->renderValue($set->getIconLabel($new)));
}
public function getTitleForFeed() {
$set = new PhabricatorProjectIconSet();
$new = $this->getNewValue();
return pht(
'%s set the icon for %s to %s.',
$this->renderAuthor(),
$this->renderObject(),
$this->renderValue($set->getIconLabel($new)));
}
public function getIcon() {
$new = $this->getNewValue();
return PhabricatorProjectIconSet::getIconIcon($new);
}
}