@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 mailKeys to Countdown

Summary: Adds mailkeys and reply handler support

Test Plan: Edit Countdown, New Countdown, no errors.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

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

+66 -1
+2
resources/sql/autopatches/20150725.countdown.mailkey.1.sql
··· 1 + ALTER TABLE {$NAMESPACE}_countdown.countdown 2 + ADD mailKey binary(20) NOT NULL;
+18
resources/sql/autopatches/20150725.countdown.mailkey.2.php
··· 1 + <?php 2 + 3 + $table = new PhabricatorCountdown(); 4 + $conn_w = $table->establishConnection('w'); 5 + $iterator = new LiskMigrationIterator($table); 6 + foreach ($iterator as $countdown) { 7 + $id = $countdown->getID(); 8 + 9 + echo pht('Adding mail key for countdown %d...', $id); 10 + echo "\n"; 11 + 12 + queryfx( 13 + $conn_w, 14 + 'UPDATE %T SET mailKey = %s WHERE id = %d', 15 + $table->getTableName(), 16 + Filesystem::readRandomCharacters(20), 17 + $id); 18 + }
+2
src/__phutil_library_map__.php
··· 1832 1832 'PhabricatorCountdownEditController' => 'applications/countdown/controller/PhabricatorCountdownEditController.php', 1833 1833 'PhabricatorCountdownEditor' => 'applications/countdown/editor/PhabricatorCountdownEditor.php', 1834 1834 'PhabricatorCountdownListController' => 'applications/countdown/controller/PhabricatorCountdownListController.php', 1835 + 'PhabricatorCountdownMailReceiver' => 'applications/countdown/mail/PhabricatorCountdownMailReceiver.php', 1835 1836 'PhabricatorCountdownQuery' => 'applications/countdown/query/PhabricatorCountdownQuery.php', 1836 1837 'PhabricatorCountdownRemarkupRule' => 'applications/countdown/remarkup/PhabricatorCountdownRemarkupRule.php', 1837 1838 'PhabricatorCountdownReplyHandler' => 'applications/countdown/mail/PhabricatorCountdownReplyHandler.php', ··· 5648 5649 'PhabricatorCountdownEditController' => 'PhabricatorCountdownController', 5649 5650 'PhabricatorCountdownEditor' => 'PhabricatorApplicationTransactionEditor', 5650 5651 'PhabricatorCountdownListController' => 'PhabricatorCountdownController', 5652 + 'PhabricatorCountdownMailReceiver' => 'PhabricatorObjectMailReceiver', 5651 5653 'PhabricatorCountdownQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 5652 5654 'PhabricatorCountdownRemarkupRule' => 'PhabricatorObjectRemarkupRule', 5653 5655 'PhabricatorCountdownReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
+7
src/applications/countdown/editor/PhabricatorCountdownEditor.php
··· 172 172 array $xactions) { 173 173 174 174 $body = parent::buildMailBody($object, $xactions); 175 + $description = $object->getDescription(); 176 + 177 + if (strlen($description)) { 178 + $body->addTextSection( 179 + pht('COUNTDOWN DESCRIPTION'), 180 + $object->getDescription()); 181 + } 175 182 176 183 $body->addLinkSection( 177 184 pht('COUNTDOWN DETAIL'),
+28
src/applications/countdown/mail/PhabricatorCountdownMailReceiver.php
··· 1 + <?php 2 + 3 + final class PhabricatorCountdownMailReceiver 4 + extends PhabricatorObjectMailReceiver { 5 + 6 + public function isEnabled() { 7 + return PhabricatorApplication::isClassInstalled( 8 + 'PhabricatorCountdownApplication'); 9 + } 10 + 11 + protected function getObjectPattern() { 12 + return 'C[1-9]\d*'; 13 + } 14 + 15 + protected function loadObject($pattern, PhabricatorUser $viewer) { 16 + $id = (int)substr($pattern, 4); 17 + 18 + return id(new PhabricatorCountdownQuery()) 19 + ->setViewer($viewer) 20 + ->withIDs(array($id)) 21 + ->executeOne(); 22 + } 23 + 24 + protected function getTransactionReplyHandler() { 25 + return new PhabricatorCountdownReplyHandler(); 26 + } 27 + 28 + }
+9 -1
src/applications/countdown/storage/PhabricatorCountdown.php
··· 16 16 protected $description; 17 17 protected $viewPolicy; 18 18 protected $editPolicy; 19 - 19 + protected $mailKey; 20 20 protected $spacePHID; 21 21 22 22 public static function initializeNewCountdown(PhabricatorUser $actor) { ··· 41 41 self::CONFIG_COLUMN_SCHEMA => array( 42 42 'title' => 'text255', 43 43 'description' => 'text', 44 + 'mailKey' => 'bytes20', 44 45 ), 45 46 ) + parent::getConfiguration(); 46 47 } ··· 52 53 53 54 public function getMonogram() { 54 55 return 'C'.$this->getID(); 56 + } 57 + 58 + public function save() { 59 + if (!$this->getMailKey()) { 60 + $this->setMailKey(Filesystem::readRandomCharacters(20)); 61 + } 62 + return parent::save(); 55 63 } 56 64 57 65