Page MenuHomePhabricator

D16871.diff
No OneTemporary

D16871.diff

diff --git a/resources/sql/autopatches/20161115.phamepost.01.subtitle.sql b/resources/sql/autopatches/20161115.phamepost.01.subtitle.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20161115.phamepost.01.subtitle.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_phame.phame_post
+ ADD subtitle VARCHAR(64) NOT NULL COLLATE {$COLLATE_TEXT};
diff --git a/src/applications/phame/editor/PhamePostEditEngine.php b/src/applications/phame/editor/PhamePostEditEngine.php
--- a/src/applications/phame/editor/PhamePostEditEngine.php
+++ b/src/applications/phame/editor/PhamePostEditEngine.php
@@ -99,6 +99,14 @@
->setConduitTypeDescription(pht('New post title.'))
->setTransactionType(PhamePostTransaction::TYPE_TITLE)
->setValue($object->getTitle()),
+ id(new PhabricatorTextEditField())
+ ->setKey('subtitle')
+ ->setLabel(pht('Subtitle'))
+ ->setDescription(pht('Post subtitle.'))
+ ->setConduitDescription(pht('Change the post subtitle.'))
+ ->setConduitTypeDescription(pht('New post subtitle.'))
+ ->setTransactionType(PhamePostTransaction::TYPE_SUBTITLE)
+ ->setValue($object->getSubtitle()),
id(new PhabricatorSelectEditField())
->setKey('visibility')
->setLabel(pht('Visibility'))
diff --git a/src/applications/phame/editor/PhamePostEditor.php b/src/applications/phame/editor/PhamePostEditor.php
--- a/src/applications/phame/editor/PhamePostEditor.php
+++ b/src/applications/phame/editor/PhamePostEditor.php
@@ -16,6 +16,7 @@
$types[] = PhamePostTransaction::TYPE_BLOG;
$types[] = PhamePostTransaction::TYPE_TITLE;
+ $types[] = PhamePostTransaction::TYPE_SUBTITLE;
$types[] = PhamePostTransaction::TYPE_BODY;
$types[] = PhamePostTransaction::TYPE_VISIBILITY;
$types[] = PhabricatorTransactions::TYPE_COMMENT;
@@ -32,6 +33,8 @@
return $object->getBlogPHID();
case PhamePostTransaction::TYPE_TITLE:
return $object->getTitle();
+ case PhamePostTransaction::TYPE_SUBTITLE:
+ return $object->getSubtitle();
case PhamePostTransaction::TYPE_BODY:
return $object->getBody();
case PhamePostTransaction::TYPE_VISIBILITY:
@@ -45,6 +48,7 @@
switch ($xaction->getTransactionType()) {
case PhamePostTransaction::TYPE_TITLE:
+ case PhamePostTransaction::TYPE_SUBTITLE:
case PhamePostTransaction::TYPE_BODY:
case PhamePostTransaction::TYPE_VISIBILITY:
case PhamePostTransaction::TYPE_BLOG:
@@ -59,6 +63,8 @@
switch ($xaction->getTransactionType()) {
case PhamePostTransaction::TYPE_TITLE:
return $object->setTitle($xaction->getNewValue());
+ case PhamePostTransaction::TYPE_SUBTITLE:
+ return $object->setSubtitle($xaction->getNewValue());
case PhamePostTransaction::TYPE_BODY:
return $object->setBody($xaction->getNewValue());
case PhamePostTransaction::TYPE_BLOG:
@@ -84,6 +90,7 @@
switch ($xaction->getTransactionType()) {
case PhamePostTransaction::TYPE_TITLE:
+ case PhamePostTransaction::TYPE_SUBTITLE:
case PhamePostTransaction::TYPE_BODY:
case PhamePostTransaction::TYPE_VISIBILITY:
case PhamePostTransaction::TYPE_BLOG:
diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php
--- a/src/applications/phame/storage/PhamePost.php
+++ b/src/applications/phame/storage/PhamePost.php
@@ -18,6 +18,7 @@
protected $bloggerPHID;
protected $title;
+ protected $subtitle;
protected $phameTitle;
protected $body;
protected $visibility;
@@ -122,6 +123,7 @@
),
self::CONFIG_COLUMN_SCHEMA => array(
'title' => 'text255',
+ 'subtitle' => 'text64',
'phameTitle' => 'sort64?',
'visibility' => 'uint32',
'mailKey' => 'bytes20',
diff --git a/src/applications/phame/storage/PhamePostTransaction.php b/src/applications/phame/storage/PhamePostTransaction.php
--- a/src/applications/phame/storage/PhamePostTransaction.php
+++ b/src/applications/phame/storage/PhamePostTransaction.php
@@ -4,6 +4,7 @@
extends PhabricatorApplicationTransaction {
const TYPE_TITLE = 'phame.post.title';
+ const TYPE_SUBTITLE = 'phame.post.subtitle';
const TYPE_BODY = 'phame.post.body';
const TYPE_VISIBILITY = 'phame.post.visibility';
const TYPE_BLOG = 'phame.post.blog';
@@ -94,6 +95,7 @@
$tags[] = self::MAILTAG_SUBSCRIBERS;
break;
case self::TYPE_TITLE:
+ case self::TYPE_SUBTITLE:
case self::TYPE_BODY:
$tags[] = self::MAILTAG_CONTENT;
break;
@@ -136,6 +138,19 @@
$new);
}
break;
+ case self::TYPE_SUBTITLE:
+ if ($old === null) {
+ return pht(
+ '%s set the post\'s subtitle to "%s".',
+ $this->renderHandleLink($author_phid),
+ $new);
+ } else {
+ return pht(
+ '%s updated the post\'s subtitle to "%s".',
+ $this->renderHandleLink($author_phid),
+ $new);
+ }
+ break;
case self::TYPE_BODY:
return pht(
'%s updated the blog post.',
@@ -195,6 +210,12 @@
$this->renderHandleLink($object_phid));
}
break;
+ case self::TYPE_SUBTITLE:
+ return pht(
+ '%s updated the subtitle for %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid));
+ break;
case self::TYPE_BODY:
return pht(
'%s updated the blog post %s.',

File Metadata

Mime Type
text/plain
Expires
Sun, May 12, 5:39 AM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6284198
Default Alt Text
D16871.diff (5 KB)

Event Timeline