mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-14 10:52:41 +01:00
00495e3a0e
Summary: Removes an unused PhabricatorFeedStory Parameter from all getTitleForFeed() and getApplicationTransactionTitleForFeed() functions. Ref D11088 Ref T6545 Test Plan: ran all unit tests and viewed some dashboard feeds Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6545 Differential Revision: https://secure.phabricator.com/D11146
101 lines
2.3 KiB
PHP
101 lines
2.3 KiB
PHP
<?php
|
|
|
|
final class PhabricatorDashboardTransaction
|
|
extends PhabricatorApplicationTransaction {
|
|
|
|
const TYPE_NAME = 'dashboard:name';
|
|
const TYPE_LAYOUT_MODE = 'dashboard:layoutmode';
|
|
|
|
public function getApplicationName() {
|
|
return 'dashboard';
|
|
}
|
|
|
|
public function getApplicationTransactionType() {
|
|
return PhabricatorDashboardDashboardPHIDType::TYPECONST;
|
|
}
|
|
|
|
public function getTitle() {
|
|
$author_phid = $this->getAuthorPHID();
|
|
$object_phid = $this->getObjectPHID();
|
|
|
|
$old = $this->getOldValue();
|
|
$new = $this->getNewValue();
|
|
|
|
$author_link = $this->renderHandleLink($author_phid);
|
|
|
|
$type = $this->getTransactionType();
|
|
switch ($type) {
|
|
case self::TYPE_NAME:
|
|
if (!strlen($old)) {
|
|
return pht(
|
|
'%s created this dashboard.',
|
|
$author_link);
|
|
} else {
|
|
return pht(
|
|
'%s renamed this dashboard from "%s" to "%s".',
|
|
$author_link,
|
|
$old,
|
|
$new);
|
|
}
|
|
}
|
|
|
|
return parent::getTitle();
|
|
}
|
|
|
|
public function getTitleForFeed() {
|
|
$author_phid = $this->getAuthorPHID();
|
|
$object_phid = $this->getObjectPHID();
|
|
|
|
$old = $this->getOldValue();
|
|
$new = $this->getNewValue();
|
|
|
|
$author_link = $this->renderHandleLink($author_phid);
|
|
$object_link = $this->renderHandleLink($object_phid);
|
|
|
|
$type = $this->getTransactionType();
|
|
switch ($type) {
|
|
case self::TYPE_NAME:
|
|
if (!strlen($old)) {
|
|
return pht(
|
|
'%s created dashboard %s.',
|
|
$author_link,
|
|
$object_link);
|
|
} else {
|
|
return pht(
|
|
'%s renamed dashboard %s from "%s" to "%s".',
|
|
$author_link,
|
|
$object_link,
|
|
$old,
|
|
$new);
|
|
}
|
|
}
|
|
|
|
return parent::getTitleForFeed();
|
|
}
|
|
|
|
public function getColor() {
|
|
$old = $this->getOldValue();
|
|
$new = $this->getNewValue();
|
|
|
|
switch ($this->getTransactionType()) {
|
|
case self::TYPE_NAME:
|
|
if (!strlen($old)) {
|
|
return PhabricatorTransactions::COLOR_GREEN;
|
|
}
|
|
break;
|
|
}
|
|
|
|
return parent::getColor();
|
|
}
|
|
|
|
public function shouldHide() {
|
|
$old = $this->getOldValue();
|
|
$new = $this->getNewValue();
|
|
|
|
switch ($this->getTransactionType()) {
|
|
case self::TYPE_LAYOUT_MODE:
|
|
return true;
|
|
}
|
|
return parent::shouldHide();
|
|
}
|
|
}
|