Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15331472
D13691.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
D13691.diff
View Options
diff --git a/resources/sql/autopatches/20150723.countdown.1.sql b/resources/sql/autopatches/20150723.countdown.1.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150723.countdown.1.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_countdown.countdown
+ ADD description LONGTEXT NOT NULL;
diff --git a/src/applications/countdown/controller/PhabricatorCountdownEditController.php b/src/applications/countdown/controller/PhabricatorCountdownEditController.php
--- a/src/applications/countdown/controller/PhabricatorCountdownEditController.php
+++ b/src/applications/countdown/controller/PhabricatorCountdownEditController.php
@@ -41,12 +41,14 @@
$e_epoch = null;
$v_text = $countdown->getTitle();
+ $v_desc = $countdown->getDescription();
$v_space = $countdown->getSpacePHID();
$v_view = $countdown->getViewPolicy();
$v_edit = $countdown->getEditPolicy();
if ($request->isFormPost()) {
$v_text = $request->getStr('title');
+ $v_desc = $request->getStr('description');
$v_space = $request->getStr('spacePHID');
$date_value = AphrontFormDateControlValue::newFromRequest(
$request,
@@ -57,6 +59,7 @@
$type_title = PhabricatorCountdownTransaction::TYPE_TITLE;
$type_epoch = PhabricatorCountdownTransaction::TYPE_EPOCH;
+ $type_description = PhabricatorCountdownTransaction::TYPE_DESCRIPTION;
$type_space = PhabricatorTransactions::TYPE_SPACE;
$type_view = PhabricatorTransactions::TYPE_VIEW_POLICY;
$type_edit = PhabricatorTransactions::TYPE_EDIT_POLICY;
@@ -72,6 +75,10 @@
->setNewValue($date_value);
$xactions[] = id(new PhabricatorCountdownTransaction())
+ ->setTransactionType($type_description)
+ ->setNewValue($v_desc);
+
+ $xactions[] = id(new PhabricatorCountdownTransaction())
->setTransactionType($type_space)
->setNewValue($v_space);
@@ -142,6 +149,11 @@
->setError($e_epoch)
->setValue($date_value))
->appendControl(
+ id(new PhabricatorRemarkupControl())
+ ->setName('description')
+ ->setLabel(pht('Description'))
+ ->setValue($v_desc))
+ ->appendControl(
id(new AphrontFormPolicyControl())
->setName('viewPolicy')
->setPolicyObject($countdown)
diff --git a/src/applications/countdown/controller/PhabricatorCountdownViewController.php b/src/applications/countdown/controller/PhabricatorCountdownViewController.php
--- a/src/applications/countdown/controller/PhabricatorCountdownViewController.php
+++ b/src/applications/countdown/controller/PhabricatorCountdownViewController.php
@@ -123,6 +123,21 @@
pht('Author'),
$viewer->renderHandle($countdown->getAuthorPHID()));
+ $view->invokeWillRenderEvent();
+
+ $description = $countdown->getDescription();
+ if (strlen($description)) {
+ $description = PhabricatorMarkupEngine::renderOneObject(
+ id(new PhabricatorMarkupOneOff())->setContent($description),
+ 'default',
+ $viewer);
+
+ $view->addSectionHeader(
+ pht('Description'),
+ PHUIPropertyListView::ICON_SUMMARY);
+ $view->addTextContent($description);
+ }
+
return $view;
}
diff --git a/src/applications/countdown/editor/PhabricatorCountdownEditor.php b/src/applications/countdown/editor/PhabricatorCountdownEditor.php
--- a/src/applications/countdown/editor/PhabricatorCountdownEditor.php
+++ b/src/applications/countdown/editor/PhabricatorCountdownEditor.php
@@ -16,6 +16,7 @@
$types[] = PhabricatorCountdownTransaction::TYPE_TITLE;
$types[] = PhabricatorCountdownTransaction::TYPE_EPOCH;
+ $types[] = PhabricatorCountdownTransaction::TYPE_DESCRIPTION;
$types[] = PhabricatorTransactions::TYPE_EDGE;
$types[] = PhabricatorTransactions::TYPE_SPACE;
@@ -31,6 +32,8 @@
switch ($xaction->getTransactionType()) {
case PhabricatorCountdownTransaction::TYPE_TITLE:
return $object->getTitle();
+ case PhabricatorCountdownTransaction::TYPE_DESCRIPTION:
+ return $object->getDescription();
case PhabricatorCountdownTransaction::TYPE_EPOCH:
return $object->getEpoch();
}
@@ -45,6 +48,8 @@
switch ($xaction->getTransactionType()) {
case PhabricatorCountdownTransaction::TYPE_TITLE:
return $xaction->getNewValue();
+ case PhabricatorCountdownTransaction::TYPE_DESCRIPTION:
+ return $xaction->getNewValue();
case PhabricatorCountdownTransaction::TYPE_EPOCH:
return $xaction->getNewValue()->getEpoch();
}
@@ -61,6 +66,9 @@
case PhabricatorCountdownTransaction::TYPE_TITLE:
$object->setTitle($xaction->getNewValue());
return;
+ case PhabricatorCountdownTransaction::TYPE_DESCRIPTION:
+ $object->setDescription($xaction->getNewValue());
+ return;
case PhabricatorCountdownTransaction::TYPE_EPOCH:
$object->setEpoch($xaction->getNewValue());
return;
@@ -77,6 +85,8 @@
switch ($type) {
case PhabricatorCountdownTransaction::TYPE_TITLE:
return;
+ case PhabricatorCountdownTransaction::TYPE_DESCRIPTION:
+ return;
case PhabricatorCountdownTransaction::TYPE_EPOCH:
return;
}
@@ -138,6 +148,8 @@
return array(
PhabricatorCountdownTransaction::MAILTAG_TITLE =>
pht('Someone changes the countdown title.'),
+ PhabricatorCountdownTransaction::MAILTAG_DESCRIPTION =>
+ pht('Someone changes the countdown description.'),
PhabricatorCountdownTransaction::MAILTAG_EPOCH =>
pht('Someone changes the countdown end date.'),
PhabricatorCountdownTransaction::MAILTAG_OTHER =>
diff --git a/src/applications/countdown/storage/PhabricatorCountdown.php b/src/applications/countdown/storage/PhabricatorCountdown.php
--- a/src/applications/countdown/storage/PhabricatorCountdown.php
+++ b/src/applications/countdown/storage/PhabricatorCountdown.php
@@ -13,6 +13,7 @@
protected $title;
protected $authorPHID;
protected $epoch;
+ protected $description;
protected $viewPolicy;
protected $editPolicy;
@@ -39,6 +40,7 @@
self::CONFIG_AUX_PHID => true,
self::CONFIG_COLUMN_SCHEMA => array(
'title' => 'text255',
+ 'description' => 'text',
),
) + parent::getConfiguration();
}
diff --git a/src/applications/countdown/storage/PhabricatorCountdownTransaction.php b/src/applications/countdown/storage/PhabricatorCountdownTransaction.php
--- a/src/applications/countdown/storage/PhabricatorCountdownTransaction.php
+++ b/src/applications/countdown/storage/PhabricatorCountdownTransaction.php
@@ -5,9 +5,11 @@
const TYPE_TITLE = 'countdown:title';
const TYPE_EPOCH = 'countdown:epoch';
+ const TYPE_DESCRIPTION = 'countdown:description';
const MAILTAG_TITLE = 'countdown:title';
const MAILTAG_EPOCH = 'countdown:epoch';
+ const MAILTAG_DESRICPTION = 'countdown:description';
const MAILTAG_OTHER = 'countdown:other';
public function getApplicationName() {
@@ -43,6 +45,18 @@
$old,
$new);
}
+ break;
+ case self::TYPE_DESCRIPTION:
+ if ($old === null) {
+ return pht(
+ '%s set the description of this countdown.',
+ $this->renderHandleLink($author_phid));
+ } else {
+ return pht(
+ '%s edited the description of this countdown.',
+ $this->renderHandleLink($author_phid));
+ }
+ break;
case self::TYPE_EPOCH:
if ($old === null) {
return pht(
@@ -84,6 +98,34 @@
$this->renderHandleLink($object_phid));
}
break;
+ case self::TYPE_DESCRIPTION:
+ if ($old === null) {
+ return pht(
+ '%s set the description of %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid));
+
+ } else {
+ return pht(
+ '%s edited the description of %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid));
+ }
+ break;
+ case self::TYPE_EPOCH:
+ if ($old === null) {
+ return pht(
+ '%s set the end date of %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid));
+
+ } else {
+ return pht(
+ '%s edited the end date of %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid));
+ }
+ break;
}
return parent::getTitleForFeed();
@@ -99,6 +141,9 @@
case self::TYPE_EPOCH:
$tags[] = self::MAILTAG_EPOCH;
break;
+ case self::TYPE_DESCRIPTION:
+ $tags[] = self::MAILTAG_DESCRIPTION;
+ break;
default:
$tags[] = self::MAILTAG_OTHER;
break;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mar 8 2025, 10:35 AM (4 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7381842
Default Alt Text
D13691.diff (8 KB)
Attached To
Mode
D13691: Add Description field to Countdowns
Attached
Detach File
Event Timeline
Log In to Comment