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 {
|
extends PhabricatorApplicationTransaction {
|
||||||
|
|
||||||
const TYPE_TITLE = 'phame.post.title';
|
const TYPE_TITLE = 'phame.post.title';
|
||||||
const TYPE_PHAME_TITLE = 'phame.post.phame.title';
|
|
||||||
const TYPE_BODY = 'phame.post.body';
|
const TYPE_BODY = 'phame.post.body';
|
||||||
const TYPE_VISIBILITY = 'phame.post.visibility';
|
const TYPE_VISIBILITY = 'phame.post.visibility';
|
||||||
const TYPE_BLOG = 'phame.post.blog';
|
const TYPE_BLOG = 'phame.post.blog';
|
||||||
|
@ -39,12 +38,6 @@ final class PhamePostTransaction
|
||||||
}
|
}
|
||||||
|
|
||||||
public function shouldHide() {
|
public function shouldHide() {
|
||||||
$old = $this->getOldValue();
|
|
||||||
switch ($this->getTransactionType()) {
|
|
||||||
case self::TYPE_PHAME_TITLE:
|
|
||||||
case self::TYPE_BODY:
|
|
||||||
return ($old === null);
|
|
||||||
}
|
|
||||||
return parent::shouldHide();
|
return parent::shouldHide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,19 +65,18 @@ final class PhamePostTransaction
|
||||||
|
|
||||||
public function getIcon() {
|
public function getIcon() {
|
||||||
$old = $this->getOldValue();
|
$old = $this->getOldValue();
|
||||||
|
$new = $this->getNewValue();
|
||||||
switch ($this->getTransactionType()) {
|
switch ($this->getTransactionType()) {
|
||||||
case self::TYPE_TITLE:
|
case PhabricatorTransactions::TYPE_CREATE:
|
||||||
if ($old === null) {
|
return 'fa-plus';
|
||||||
return 'fa-plus';
|
break;
|
||||||
} else {
|
|
||||||
return 'fa-pencil';
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case self::TYPE_PHAME_TITLE:
|
|
||||||
case self::TYPE_BODY:
|
|
||||||
case self::TYPE_VISIBILITY:
|
case self::TYPE_VISIBILITY:
|
||||||
return 'fa-pencil';
|
if ($new == PhameConstants::VISIBILITY_PUBLISHED) {
|
||||||
break;
|
return 'fa-globe';
|
||||||
|
} else {
|
||||||
|
return 'fa-eye-slash';
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return parent::getIcon();
|
return parent::getIcon();
|
||||||
}
|
}
|
||||||
|
@ -100,7 +92,6 @@ final class PhamePostTransaction
|
||||||
$tags[] = self::MAILTAG_SUBSCRIBERS;
|
$tags[] = self::MAILTAG_SUBSCRIBERS;
|
||||||
break;
|
break;
|
||||||
case self::TYPE_TITLE:
|
case self::TYPE_TITLE:
|
||||||
case self::TYPE_PHAME_TITLE:
|
|
||||||
case self::TYPE_BODY:
|
case self::TYPE_BODY:
|
||||||
$tags[] = self::MAILTAG_CONTENT;
|
$tags[] = self::MAILTAG_CONTENT;
|
||||||
break;
|
break;
|
||||||
|
@ -123,7 +114,7 @@ final class PhamePostTransaction
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case PhabricatorTransactions::TYPE_CREATE:
|
case PhabricatorTransactions::TYPE_CREATE:
|
||||||
return pht(
|
return pht(
|
||||||
'%s created this post.',
|
'%s authored this post.',
|
||||||
$this->renderHandleLink($author_phid));
|
$this->renderHandleLink($author_phid));
|
||||||
case self::TYPE_BLOG:
|
case self::TYPE_BLOG:
|
||||||
return pht(
|
return pht(
|
||||||
|
@ -159,12 +150,6 @@ final class PhamePostTransaction
|
||||||
$this->renderHandleLink($author_phid));
|
$this->renderHandleLink($author_phid));
|
||||||
}
|
}
|
||||||
break;
|
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();
|
return parent::getTitle();
|
||||||
|
@ -179,6 +164,11 @@ final class PhamePostTransaction
|
||||||
|
|
||||||
$type = $this->getTransactionType();
|
$type = $this->getTransactionType();
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
case PhabricatorTransactions::TYPE_CREATE:
|
||||||
|
return pht(
|
||||||
|
'%s authored %s.',
|
||||||
|
$this->renderHandleLink($author_phid),
|
||||||
|
$this->renderHandleLink($object_phid));
|
||||||
case self::TYPE_BLOG:
|
case self::TYPE_BLOG:
|
||||||
return pht(
|
return pht(
|
||||||
'%s moved post "%s" from "%s" to "%s".',
|
'%s moved post "%s" from "%s" to "%s".',
|
||||||
|
@ -218,37 +208,30 @@ final class PhamePostTransaction
|
||||||
$this->renderHandleLink($object_phid));
|
$this->renderHandleLink($object_phid));
|
||||||
}
|
}
|
||||||
break;
|
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();
|
return parent::getTitleForFeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRemarkupBodyForFeed(PhabricatorFeedStory $story) {
|
public function getRemarkupBodyForFeed(PhabricatorFeedStory $story) {
|
||||||
|
$old = $this->getOldValue();
|
||||||
|
|
||||||
switch ($this->getTransactionType()) {
|
switch ($this->getTransactionType()) {
|
||||||
case self::TYPE_BODY:
|
case self::TYPE_BODY:
|
||||||
return $this->getNewValue();
|
if ($old === null) {
|
||||||
|
return $this->getNewValue();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getColor() {
|
public function getColor() {
|
||||||
$old = $this->getOldValue();
|
|
||||||
|
|
||||||
switch ($this->getTransactionType()) {
|
switch ($this->getTransactionType()) {
|
||||||
case self::TYPE_TITLE:
|
case PhabricatorTransactions::TYPE_CREATE:
|
||||||
if ($old === null) {
|
return PhabricatorTransactions::COLOR_GREEN;
|
||||||
return PhabricatorTransactions::COLOR_GREEN;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::getColor();
|
return parent::getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue