@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add Description field to Countdowns

Summary: Allows countdowns to have a description.

Test Plan: Use description, edit description. Check timeline, etc.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13691

+88
+2
resources/sql/autopatches/20150723.countdown.1.sql
··· 1 + ALTER TABLE {$NAMESPACE}_countdown.countdown 2 + ADD description LONGTEXT NOT NULL;
+12
src/applications/countdown/controller/PhabricatorCountdownEditController.php
··· 41 41 $e_epoch = null; 42 42 43 43 $v_text = $countdown->getTitle(); 44 + $v_desc = $countdown->getDescription(); 44 45 $v_space = $countdown->getSpacePHID(); 45 46 $v_view = $countdown->getViewPolicy(); 46 47 $v_edit = $countdown->getEditPolicy(); 47 48 48 49 if ($request->isFormPost()) { 49 50 $v_text = $request->getStr('title'); 51 + $v_desc = $request->getStr('description'); 50 52 $v_space = $request->getStr('spacePHID'); 51 53 $date_value = AphrontFormDateControlValue::newFromRequest( 52 54 $request, ··· 57 59 58 60 $type_title = PhabricatorCountdownTransaction::TYPE_TITLE; 59 61 $type_epoch = PhabricatorCountdownTransaction::TYPE_EPOCH; 62 + $type_description = PhabricatorCountdownTransaction::TYPE_DESCRIPTION; 60 63 $type_space = PhabricatorTransactions::TYPE_SPACE; 61 64 $type_view = PhabricatorTransactions::TYPE_VIEW_POLICY; 62 65 $type_edit = PhabricatorTransactions::TYPE_EDIT_POLICY; ··· 70 73 $xactions[] = id(new PhabricatorCountdownTransaction()) 71 74 ->setTransactionType($type_epoch) 72 75 ->setNewValue($date_value); 76 + 77 + $xactions[] = id(new PhabricatorCountdownTransaction()) 78 + ->setTransactionType($type_description) 79 + ->setNewValue($v_desc); 73 80 74 81 $xactions[] = id(new PhabricatorCountdownTransaction()) 75 82 ->setTransactionType($type_space) ··· 141 148 ->setLabel(pht('End Date')) 142 149 ->setError($e_epoch) 143 150 ->setValue($date_value)) 151 + ->appendControl( 152 + id(new PhabricatorRemarkupControl()) 153 + ->setName('description') 154 + ->setLabel(pht('Description')) 155 + ->setValue($v_desc)) 144 156 ->appendControl( 145 157 id(new AphrontFormPolicyControl()) 146 158 ->setName('viewPolicy')
+15
src/applications/countdown/controller/PhabricatorCountdownViewController.php
··· 123 123 pht('Author'), 124 124 $viewer->renderHandle($countdown->getAuthorPHID())); 125 125 126 + $view->invokeWillRenderEvent(); 127 + 128 + $description = $countdown->getDescription(); 129 + if (strlen($description)) { 130 + $description = PhabricatorMarkupEngine::renderOneObject( 131 + id(new PhabricatorMarkupOneOff())->setContent($description), 132 + 'default', 133 + $viewer); 134 + 135 + $view->addSectionHeader( 136 + pht('Description'), 137 + PHUIPropertyListView::ICON_SUMMARY); 138 + $view->addTextContent($description); 139 + } 140 + 126 141 return $view; 127 142 } 128 143
+12
src/applications/countdown/editor/PhabricatorCountdownEditor.php
··· 16 16 17 17 $types[] = PhabricatorCountdownTransaction::TYPE_TITLE; 18 18 $types[] = PhabricatorCountdownTransaction::TYPE_EPOCH; 19 + $types[] = PhabricatorCountdownTransaction::TYPE_DESCRIPTION; 19 20 20 21 $types[] = PhabricatorTransactions::TYPE_EDGE; 21 22 $types[] = PhabricatorTransactions::TYPE_SPACE; ··· 31 32 switch ($xaction->getTransactionType()) { 32 33 case PhabricatorCountdownTransaction::TYPE_TITLE: 33 34 return $object->getTitle(); 35 + case PhabricatorCountdownTransaction::TYPE_DESCRIPTION: 36 + return $object->getDescription(); 34 37 case PhabricatorCountdownTransaction::TYPE_EPOCH: 35 38 return $object->getEpoch(); 36 39 } ··· 45 48 switch ($xaction->getTransactionType()) { 46 49 case PhabricatorCountdownTransaction::TYPE_TITLE: 47 50 return $xaction->getNewValue(); 51 + case PhabricatorCountdownTransaction::TYPE_DESCRIPTION: 52 + return $xaction->getNewValue(); 48 53 case PhabricatorCountdownTransaction::TYPE_EPOCH: 49 54 return $xaction->getNewValue()->getEpoch(); 50 55 } ··· 61 66 case PhabricatorCountdownTransaction::TYPE_TITLE: 62 67 $object->setTitle($xaction->getNewValue()); 63 68 return; 69 + case PhabricatorCountdownTransaction::TYPE_DESCRIPTION: 70 + $object->setDescription($xaction->getNewValue()); 71 + return; 64 72 case PhabricatorCountdownTransaction::TYPE_EPOCH: 65 73 $object->setEpoch($xaction->getNewValue()); 66 74 return; ··· 76 84 $type = $xaction->getTransactionType(); 77 85 switch ($type) { 78 86 case PhabricatorCountdownTransaction::TYPE_TITLE: 87 + return; 88 + case PhabricatorCountdownTransaction::TYPE_DESCRIPTION: 79 89 return; 80 90 case PhabricatorCountdownTransaction::TYPE_EPOCH: 81 91 return; ··· 138 148 return array( 139 149 PhabricatorCountdownTransaction::MAILTAG_TITLE => 140 150 pht('Someone changes the countdown title.'), 151 + PhabricatorCountdownTransaction::MAILTAG_DESCRIPTION => 152 + pht('Someone changes the countdown description.'), 141 153 PhabricatorCountdownTransaction::MAILTAG_EPOCH => 142 154 pht('Someone changes the countdown end date.'), 143 155 PhabricatorCountdownTransaction::MAILTAG_OTHER =>
+2
src/applications/countdown/storage/PhabricatorCountdown.php
··· 13 13 protected $title; 14 14 protected $authorPHID; 15 15 protected $epoch; 16 + protected $description; 16 17 protected $viewPolicy; 17 18 protected $editPolicy; 18 19 ··· 39 40 self::CONFIG_AUX_PHID => true, 40 41 self::CONFIG_COLUMN_SCHEMA => array( 41 42 'title' => 'text255', 43 + 'description' => 'text', 42 44 ), 43 45 ) + parent::getConfiguration(); 44 46 }
+45
src/applications/countdown/storage/PhabricatorCountdownTransaction.php
··· 5 5 6 6 const TYPE_TITLE = 'countdown:title'; 7 7 const TYPE_EPOCH = 'countdown:epoch'; 8 + const TYPE_DESCRIPTION = 'countdown:description'; 8 9 9 10 const MAILTAG_TITLE = 'countdown:title'; 10 11 const MAILTAG_EPOCH = 'countdown:epoch'; 12 + const MAILTAG_DESRICPTION = 'countdown:description'; 11 13 const MAILTAG_OTHER = 'countdown:other'; 12 14 13 15 public function getApplicationName() { ··· 43 45 $old, 44 46 $new); 45 47 } 48 + break; 49 + case self::TYPE_DESCRIPTION: 50 + if ($old === null) { 51 + return pht( 52 + '%s set the description of this countdown.', 53 + $this->renderHandleLink($author_phid)); 54 + } else { 55 + return pht( 56 + '%s edited the description of this countdown.', 57 + $this->renderHandleLink($author_phid)); 58 + } 59 + break; 46 60 case self::TYPE_EPOCH: 47 61 if ($old === null) { 48 62 return pht( ··· 84 98 $this->renderHandleLink($object_phid)); 85 99 } 86 100 break; 101 + case self::TYPE_DESCRIPTION: 102 + if ($old === null) { 103 + return pht( 104 + '%s set the description of %s.', 105 + $this->renderHandleLink($author_phid), 106 + $this->renderHandleLink($object_phid)); 107 + 108 + } else { 109 + return pht( 110 + '%s edited the description of %s.', 111 + $this->renderHandleLink($author_phid), 112 + $this->renderHandleLink($object_phid)); 113 + } 114 + break; 115 + case self::TYPE_EPOCH: 116 + if ($old === null) { 117 + return pht( 118 + '%s set the end date of %s.', 119 + $this->renderHandleLink($author_phid), 120 + $this->renderHandleLink($object_phid)); 121 + 122 + } else { 123 + return pht( 124 + '%s edited the end date of %s.', 125 + $this->renderHandleLink($author_phid), 126 + $this->renderHandleLink($object_phid)); 127 + } 128 + break; 87 129 } 88 130 89 131 return parent::getTitleForFeed(); ··· 98 140 break; 99 141 case self::TYPE_EPOCH: 100 142 $tags[] = self::MAILTAG_EPOCH; 143 + break; 144 + case self::TYPE_DESCRIPTION: 145 + $tags[] = self::MAILTAG_DESCRIPTION; 101 146 break; 102 147 default: 103 148 $tags[] = self::MAILTAG_OTHER;