Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phame/storage/PhameBlogTransaction.php
<?php | <?php | ||||
final class PhameBlogTransaction | final class PhameBlogTransaction | ||||
extends PhabricatorApplicationTransaction { | extends PhabricatorApplicationTransaction { | ||||
const TYPE_NAME = 'phame.blog.name'; | const TYPE_NAME = 'phame.blog.name'; | ||||
const TYPE_DESCRIPTION = 'phame.blog.description'; | const TYPE_DESCRIPTION = 'phame.blog.description'; | ||||
const TYPE_DOMAIN = 'phame.blog.domain'; | const TYPE_DOMAIN = 'phame.blog.domain'; | ||||
const TYPE_SKIN = 'phame.blog.skin'; | const TYPE_SKIN = 'phame.blog.skin'; | ||||
const MAILTAG_DETAILS = 'phame-blog-details'; | |||||
const MAILTAG_SUBSCRIBERS = 'phame-blog-subscribers'; | |||||
const MAILTAG_OTHER = 'phame-blog-other'; | |||||
public function getApplicationName() { | public function getApplicationName() { | ||||
return 'phame'; | return 'phame'; | ||||
} | } | ||||
public function getApplicationTransactionType() { | public function getApplicationTransactionType() { | ||||
return PhabricatorPhameBlogPHIDType::TYPECONST; | return PhabricatorPhameBlogPHIDType::TYPECONST; | ||||
} | } | ||||
Show All 20 Lines | switch ($this->getTransactionType()) { | ||||
case self::TYPE_DOMAIN: | case self::TYPE_DOMAIN: | ||||
case self::TYPE_SKIN: | case self::TYPE_SKIN: | ||||
return 'fa-pencil'; | return 'fa-pencil'; | ||||
break; | break; | ||||
} | } | ||||
return parent::getIcon(); | return parent::getIcon(); | ||||
} | } | ||||
public function getMailTags() { | |||||
$tags = parent::getMailTags(); | |||||
switch ($this->getTransactionType()) { | |||||
case PhabricatorTransactions::TYPE_SUBSCRIBERS: | |||||
$tags[] = self::MAILTAG_SUBSCRIBERS; | |||||
break; | |||||
case self::TYPE_NAME: | |||||
case self::TYPE_DESCRIPTION: | |||||
case self::TYPE_DOMAIN: | |||||
case self::TYPE_SKIN: | |||||
$tags[] = self::MAILTAG_DETAILS; | |||||
break; | |||||
default: | |||||
$tags[] = self::MAILTAG_OTHER; | |||||
break; | |||||
} | |||||
return $tags; | |||||
} | |||||
public function getTitle() { | public function getTitle() { | ||||
$author_phid = $this->getAuthorPHID(); | $author_phid = $this->getAuthorPHID(); | ||||
$object_phid = $this->getObjectPHID(); | $object_phid = $this->getObjectPHID(); | ||||
$old = $this->getOldValue(); | $old = $this->getOldValue(); | ||||
$new = $this->getNewValue(); | $new = $this->getNewValue(); | ||||
$type = $this->getTransactionType(); | $type = $this->getTransactionType(); | ||||
switch ($type) { | switch ($type) { | ||||
case self:TYPE_NAME: | case self::TYPE_NAME: | ||||
if ($old === null) { | if ($old === null) { | ||||
return pht( | return pht( | ||||
'%s created this blog.', | '%s created this blog.', | ||||
$this->renderHandleLink($author_phid)); | $this->renderHandleLink($author_phid)); | ||||
} else { | } else { | ||||
return pht( | return pht( | ||||
'%s updated the blog\'s name to "%s".', | '%s updated the blog\'s name to "%s".', | ||||
$this->renderHandleLink($author_phid), | $this->renderHandleLink($author_phid), | ||||
▲ Show 20 Lines • Show All 110 Lines • Show Last 20 Lines |