mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Update some PhamePost transactions
Summary: Cleans up some language, colors, etc. Test Plan: Write lots of new posts, hide them, edit them, check history. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T9360 Differential Revision: https://secure.phabricator.com/D14914
This commit is contained in:
parent
4acb7f63e8
commit
5ea5b0c41c
1 changed files with 24 additions and 41 deletions
|
@ -4,7 +4,6 @@ final class PhamePostTransaction
|
|||
extends PhabricatorApplicationTransaction {
|
||||
|
||||
const TYPE_TITLE = 'phame.post.title';
|
||||
const TYPE_PHAME_TITLE = 'phame.post.phame.title';
|
||||
const TYPE_BODY = 'phame.post.body';
|
||||
const TYPE_VISIBILITY = 'phame.post.visibility';
|
||||
const TYPE_BLOG = 'phame.post.blog';
|
||||
|
@ -39,12 +38,6 @@ final class PhamePostTransaction
|
|||
}
|
||||
|
||||
public function shouldHide() {
|
||||
$old = $this->getOldValue();
|
||||
switch ($this->getTransactionType()) {
|
||||
case self::TYPE_PHAME_TITLE:
|
||||
case self::TYPE_BODY:
|
||||
return ($old === null);
|
||||
}
|
||||
return parent::shouldHide();
|
||||
}
|
||||
|
||||
|
@ -72,19 +65,18 @@ final class PhamePostTransaction
|
|||
|
||||
public function getIcon() {
|
||||
$old = $this->getOldValue();
|
||||
$new = $this->getNewValue();
|
||||
switch ($this->getTransactionType()) {
|
||||
case self::TYPE_TITLE:
|
||||
if ($old === null) {
|
||||
return 'fa-plus';
|
||||
} else {
|
||||
return 'fa-pencil';
|
||||
}
|
||||
break;
|
||||
case self::TYPE_PHAME_TITLE:
|
||||
case self::TYPE_BODY:
|
||||
case PhabricatorTransactions::TYPE_CREATE:
|
||||
return 'fa-plus';
|
||||
break;
|
||||
case self::TYPE_VISIBILITY:
|
||||
return 'fa-pencil';
|
||||
break;
|
||||
if ($new == PhameConstants::VISIBILITY_PUBLISHED) {
|
||||
return 'fa-globe';
|
||||
} else {
|
||||
return 'fa-eye-slash';
|
||||
}
|
||||
break;
|
||||
}
|
||||
return parent::getIcon();
|
||||
}
|
||||
|
@ -100,7 +92,6 @@ final class PhamePostTransaction
|
|||
$tags[] = self::MAILTAG_SUBSCRIBERS;
|
||||
break;
|
||||
case self::TYPE_TITLE:
|
||||
case self::TYPE_PHAME_TITLE:
|
||||
case self::TYPE_BODY:
|
||||
$tags[] = self::MAILTAG_CONTENT;
|
||||
break;
|
||||
|
@ -123,7 +114,7 @@ final class PhamePostTransaction
|
|||
switch ($type) {
|
||||
case PhabricatorTransactions::TYPE_CREATE:
|
||||
return pht(
|
||||
'%s created this post.',
|
||||
'%s authored this post.',
|
||||
$this->renderHandleLink($author_phid));
|
||||
case self::TYPE_BLOG:
|
||||
return pht(
|
||||
|
@ -159,12 +150,6 @@ final class PhamePostTransaction
|
|||
$this->renderHandleLink($author_phid));
|
||||
}
|
||||
break;
|
||||
case self::TYPE_PHAME_TITLE:
|
||||
return pht(
|
||||
'%s updated the post\'s Phame title to "%s".',
|
||||
$this->renderHandleLink($author_phid),
|
||||
rtrim($new, '/'));
|
||||
break;
|
||||
}
|
||||
|
||||
return parent::getTitle();
|
||||
|
@ -179,6 +164,11 @@ final class PhamePostTransaction
|
|||
|
||||
$type = $this->getTransactionType();
|
||||
switch ($type) {
|
||||
case PhabricatorTransactions::TYPE_CREATE:
|
||||
return pht(
|
||||
'%s authored %s.',
|
||||
$this->renderHandleLink($author_phid),
|
||||
$this->renderHandleLink($object_phid));
|
||||
case self::TYPE_BLOG:
|
||||
return pht(
|
||||
'%s moved post "%s" from "%s" to "%s".',
|
||||
|
@ -218,37 +208,30 @@ final class PhamePostTransaction
|
|||
$this->renderHandleLink($object_phid));
|
||||
}
|
||||
break;
|
||||
case self::TYPE_PHAME_TITLE:
|
||||
return pht(
|
||||
'%s updated the Phame title for %s.',
|
||||
$this->renderHandleLink($author_phid),
|
||||
$this->renderHandleLink($object_phid));
|
||||
break;
|
||||
}
|
||||
|
||||
return parent::getTitleForFeed();
|
||||
}
|
||||
|
||||
public function getRemarkupBodyForFeed(PhabricatorFeedStory $story) {
|
||||
$old = $this->getOldValue();
|
||||
|
||||
switch ($this->getTransactionType()) {
|
||||
case self::TYPE_BODY:
|
||||
return $this->getNewValue();
|
||||
if ($old === null) {
|
||||
return $this->getNewValue();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getColor() {
|
||||
$old = $this->getOldValue();
|
||||
|
||||
switch ($this->getTransactionType()) {
|
||||
case self::TYPE_TITLE:
|
||||
if ($old === null) {
|
||||
return PhabricatorTransactions::COLOR_GREEN;
|
||||
}
|
||||
break;
|
||||
case PhabricatorTransactions::TYPE_CREATE:
|
||||
return PhabricatorTransactions::COLOR_GREEN;
|
||||
}
|
||||
|
||||
return parent::getColor();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue