@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.

Modernize Conpherence with Modular Transactions

Summary: Begin converting Conpherence to ModularTransactions, this converts title, topic, and picture to use modular transactions. Participants seems hairy so I'll do that in another diff

Test Plan: Create a room with a topic, change room name, topic. Add people, remove people. Set a room image. Unset topic.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

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

+248 -192
+3 -3
resources/celerity/map.php
··· 9 9 'names' => array( 10 10 'conpherence.pkg.css' => 'b5ee2073', 11 11 'conpherence.pkg.js' => '281b1a73', 12 - 'core.pkg.css' => '476a4ec7', 12 + 'core.pkg.css' => '30a64ed6', 13 13 'core.pkg.js' => 'fbc1c380', 14 14 'darkconsole.pkg.js' => 'e7393ebb', 15 15 'differential.pkg.css' => '90b30783', ··· 167 167 'rsrc/css/phui/phui-spacing.css' => '042804d6', 168 168 'rsrc/css/phui/phui-status.css' => 'd5263e49', 169 169 'rsrc/css/phui/phui-tag-view.css' => '84d65f26', 170 - 'rsrc/css/phui/phui-timeline-view.css' => 'bf45789e', 170 + 'rsrc/css/phui/phui-timeline-view.css' => '1d7ef61d', 171 171 'rsrc/css/phui/phui-two-column-view.css' => 'ce9fa0b7', 172 172 'rsrc/css/phui/workboards/phui-workboard-color.css' => '783cdff5', 173 173 'rsrc/css/phui/workboards/phui-workboard.css' => '3bc85455', ··· 877 877 'phui-status-list-view-css' => 'd5263e49', 878 878 'phui-tag-view-css' => '84d65f26', 879 879 'phui-theme-css' => '9f261c6b', 880 - 'phui-timeline-view-css' => 'bf45789e', 880 + 'phui-timeline-view-css' => '1d7ef61d', 881 881 'phui-two-column-view-css' => 'ce9fa0b7', 882 882 'phui-workboard-color-css' => '783cdff5', 883 883 'phui-workboard-view-css' => '3bc85455',
+9 -1
src/__phutil_library_map__.php
··· 320 320 'ConpherenceThreadListView' => 'applications/conpherence/view/ConpherenceThreadListView.php', 321 321 'ConpherenceThreadMailReceiver' => 'applications/conpherence/mail/ConpherenceThreadMailReceiver.php', 322 322 'ConpherenceThreadMembersPolicyRule' => 'applications/conpherence/policyrule/ConpherenceThreadMembersPolicyRule.php', 323 + 'ConpherenceThreadPictureTransaction' => 'applications/conpherence/xaction/ConpherenceThreadPictureTransaction.php', 323 324 'ConpherenceThreadQuery' => 'applications/conpherence/query/ConpherenceThreadQuery.php', 324 325 'ConpherenceThreadRemarkupRule' => 'applications/conpherence/remarkup/ConpherenceThreadRemarkupRule.php', 325 326 'ConpherenceThreadSearchController' => 'applications/conpherence/controller/ConpherenceThreadSearchController.php', 326 327 'ConpherenceThreadSearchEngine' => 'applications/conpherence/query/ConpherenceThreadSearchEngine.php', 327 328 'ConpherenceThreadTitleNgrams' => 'applications/conpherence/storage/ConpherenceThreadTitleNgrams.php', 329 + 'ConpherenceThreadTitleTransaction' => 'applications/conpherence/xaction/ConpherenceThreadTitleTransaction.php', 330 + 'ConpherenceThreadTopicTransaction' => 'applications/conpherence/xaction/ConpherenceThreadTopicTransaction.php', 331 + 'ConpherenceThreadTransactionType' => 'applications/conpherence/xaction/ConpherenceThreadTransactionType.php', 328 332 'ConpherenceTransaction' => 'applications/conpherence/storage/ConpherenceTransaction.php', 329 333 'ConpherenceTransactionComment' => 'applications/conpherence/storage/ConpherenceTransactionComment.php', 330 334 'ConpherenceTransactionQuery' => 'applications/conpherence/query/ConpherenceTransactionQuery.php', ··· 5099 5103 'ConpherenceThreadListView' => 'AphrontView', 5100 5104 'ConpherenceThreadMailReceiver' => 'PhabricatorObjectMailReceiver', 5101 5105 'ConpherenceThreadMembersPolicyRule' => 'PhabricatorPolicyRule', 5106 + 'ConpherenceThreadPictureTransaction' => 'ConpherenceThreadTransactionType', 5102 5107 'ConpherenceThreadQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 5103 5108 'ConpherenceThreadRemarkupRule' => 'PhabricatorObjectRemarkupRule', 5104 5109 'ConpherenceThreadSearchController' => 'ConpherenceController', 5105 5110 'ConpherenceThreadSearchEngine' => 'PhabricatorApplicationSearchEngine', 5106 5111 'ConpherenceThreadTitleNgrams' => 'PhabricatorSearchNgrams', 5107 - 'ConpherenceTransaction' => 'PhabricatorApplicationTransaction', 5112 + 'ConpherenceThreadTitleTransaction' => 'ConpherenceThreadTransactionType', 5113 + 'ConpherenceThreadTopicTransaction' => 'ConpherenceThreadTransactionType', 5114 + 'ConpherenceThreadTransactionType' => 'PhabricatorModularTransactionType', 5115 + 'ConpherenceTransaction' => 'PhabricatorModularTransaction', 5108 5116 'ConpherenceTransactionComment' => 'PhabricatorApplicationTransactionComment', 5109 5117 'ConpherenceTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 5110 5118 'ConpherenceTransactionRenderer' => 'Phobject',
+2 -1
src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php
··· 123 123 ->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS) 124 124 ->setNewValue(array('+' => $participant_phids)); 125 125 $xactions[] = id(new ConpherenceTransaction()) 126 - ->setTransactionType(ConpherenceTransaction::TYPE_TITLE) 126 + ->setTransactionType( 127 + ConpherenceThreadTitleTransaction::TRANSACTIONTYPE) 127 128 ->setNewValue(pht('Test')); 128 129 129 130 id(new ConpherenceEditor())
+2 -1
src/applications/conpherence/conduit/ConpherenceUpdateThreadConduitAPIMethod.php
··· 83 83 } 84 84 if ($title) { 85 85 $xactions[] = id(new ConpherenceTransaction()) 86 - ->setTransactionType(ConpherenceTransaction::TYPE_TITLE) 86 + ->setTransactionType( 87 + ConpherenceThreadTitleTransaction::TRANSACTIONTYPE) 87 88 ->setNewValue($title); 88 89 } 89 90 if ($message) {
+4 -3
src/applications/conpherence/controller/ConpherenceNewRoomController.php
··· 16 16 $xactions = array(); 17 17 18 18 $xactions[] = id(new ConpherenceTransaction()) 19 - ->setTransactionType(ConpherenceTransaction::TYPE_TITLE) 19 + ->setTransactionType(ConpherenceThreadTitleTransaction::TRANSACTIONTYPE) 20 20 ->setNewValue($request->getStr('title')); 21 21 22 22 $participants = $request->getArr('participants'); ··· 26 26 ->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS) 27 27 ->setNewValue(array('+' => $participants)); 28 28 $xactions[] = id(new ConpherenceTransaction()) 29 - ->setTransactionType(ConpherenceTransaction::TYPE_TOPIC) 29 + ->setTransactionType(ConpherenceThreadTopicTransaction::TRANSACTIONTYPE) 30 30 ->setNewValue($request->getStr('topic')); 31 31 $xactions[] = id(new ConpherenceTransaction()) 32 32 ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY) ··· 50 50 } catch (PhabricatorApplicationTransactionValidationException $ex) { 51 51 $validation_exception = $ex; 52 52 53 - $e_title = $ex->getShortMessage(ConpherenceTransaction::TYPE_TITLE); 53 + $e_title = $ex->getShortMessage( 54 + ConpherenceThreadTitleTransaction::TRANSACTIONTYPE); 54 55 55 56 $conpherence->setViewPolicy($request->getStr('viewPolicy')); 56 57 $conpherence->setEditPolicy($request->getStr('editPolicy'));
+2 -1
src/applications/conpherence/controller/ConpherenceRoomPictureController.php
··· 76 76 77 77 $xactions = array(); 78 78 $xactions[] = id(new ConpherenceTransaction()) 79 - ->setTransactionType(ConpherenceTransaction::TYPE_PICTURE) 79 + ->setTransactionType( 80 + ConpherenceThreadPictureTransaction::TRANSACTIONTYPE) 80 81 ->setNewValue($new_value); 81 82 82 83 $editor = id(new ConpherenceEditor())
+4 -2
src/applications/conpherence/controller/ConpherenceUpdateController.php
··· 140 140 $title = $request->getStr('title'); 141 141 $topic = $request->getStr('topic'); 142 142 $xactions[] = id(new ConpherenceTransaction()) 143 - ->setTransactionType(ConpherenceTransaction::TYPE_TITLE) 143 + ->setTransactionType( 144 + ConpherenceThreadTitleTransaction::TRANSACTIONTYPE) 144 145 ->setNewValue($title); 145 146 $xactions[] = id(new ConpherenceTransaction()) 146 - ->setTransactionType(ConpherenceTransaction::TYPE_TOPIC) 147 + ->setTransactionType( 148 + ConpherenceThreadTopicTransaction::TRANSACTIONTYPE) 147 149 ->setNewValue($topic); 148 150 $xactions[] = id(new ConpherenceTransaction()) 149 151 ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)
+29 -65
src/applications/conpherence/editor/ConpherenceEditor.php
··· 41 41 ->setNewValue(array('+' => $participant_phids)); 42 42 if ($title) { 43 43 $xactions[] = id(new ConpherenceTransaction()) 44 - ->setTransactionType(ConpherenceTransaction::TYPE_TITLE) 44 + ->setTransactionType( 45 + ConpherenceThreadTitleTransaction::TRANSACTIONTYPE) 45 46 ->setNewValue($title); 46 47 } 47 48 if (strlen($topic)) { 48 49 $xactions[] = id(new ConpherenceTransaction()) 49 - ->setTransactionType(ConpherenceTransaction::TYPE_TOPIC) 50 + ->setTransactionType( 51 + ConpherenceThreadTopicTransaction::TRANSACTIONTYPE) 50 52 ->setNewValue($topic); 51 53 } 52 54 ··· 87 89 88 90 $types[] = PhabricatorTransactions::TYPE_COMMENT; 89 91 90 - $types[] = ConpherenceTransaction::TYPE_TITLE; 91 - $types[] = ConpherenceTransaction::TYPE_TOPIC; 92 92 $types[] = ConpherenceTransaction::TYPE_PARTICIPANTS; 93 - $types[] = ConpherenceTransaction::TYPE_PICTURE; 94 93 $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; 95 94 $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY; 96 95 $types[] = PhabricatorTransactions::TYPE_JOIN_POLICY; ··· 98 97 return $types; 99 98 } 100 99 100 + public function getCreateObjectTitle($author, $object) { 101 + return pht('%s created this room.', $author); 102 + } 103 + 104 + protected function shouldPublishFeedStory( 105 + PhabricatorLiskDAO $object, 106 + array $xactions) { 107 + 108 + foreach ($xactions as $xaction) { 109 + switch ($xaction->getTransactionType()) { 110 + case ConpherenceThreadTitleTransaction::TRANSACTIONTYPE: 111 + case ConpherenceThreadTopicTransaction::TRANSACTIONTYPE: 112 + case ConpherenceThreadPictureTransaction::TRANSACTIONTYPE: 113 + return true; 114 + default: 115 + return false; 116 + } 117 + } 118 + return true; 119 + } 120 + 121 + 122 + 101 123 protected function getCustomTransactionOldValue( 102 124 PhabricatorLiskDAO $object, 103 125 PhabricatorApplicationTransaction $xaction) { 104 126 105 127 switch ($xaction->getTransactionType()) { 106 - case ConpherenceTransaction::TYPE_TITLE: 107 - return $object->getTitle(); 108 - case ConpherenceTransaction::TYPE_TOPIC: 109 - return $object->getTopic(); 110 - case ConpherenceTransaction::TYPE_PICTURE: 111 - return $object->getProfileImagePHID(); 112 128 case ConpherenceTransaction::TYPE_PARTICIPANTS: 113 129 if ($this->getIsNewObject()) { 114 130 return array(); ··· 122 138 PhabricatorApplicationTransaction $xaction) { 123 139 124 140 switch ($xaction->getTransactionType()) { 125 - case ConpherenceTransaction::TYPE_TITLE: 126 - case ConpherenceTransaction::TYPE_TOPIC: 127 - case ConpherenceTransaction::TYPE_PICTURE: 128 - return $xaction->getNewValue(); 129 141 case ConpherenceTransaction::TYPE_PARTICIPANTS: 130 142 return $this->getPHIDTransactionNewValue($xaction); 131 143 } ··· 211 223 212 224 $make_author_recent_participant = true; 213 225 switch ($xaction->getTransactionType()) { 214 - case ConpherenceTransaction::TYPE_TITLE: 215 - $object->setTitle($xaction->getNewValue()); 216 - break; 217 - case ConpherenceTransaction::TYPE_TOPIC: 218 - $object->setTopic($xaction->getNewValue()); 219 - break; 220 - case ConpherenceTransaction::TYPE_PICTURE: 221 - $object->setProfileImagePHID($xaction->getNewValue()); 222 - break; 223 226 case ConpherenceTransaction::TYPE_PARTICIPANTS: 224 227 if (!$this->getIsNewObject()) { 225 228 $old_map = array_fuse($xaction->getOldValue()); ··· 418 421 PhabricatorPolicyCapability::CAN_EDIT); 419 422 } 420 423 break; 421 - case ConpherenceTransaction::TYPE_TITLE: 422 - case ConpherenceTransaction::TYPE_TOPIC: 424 + case ConpherenceThreadTitleTransaction::TRANSACTIONTYPE: 425 + case ConpherenceThreadTopicTransaction::TRANSACTIONTYPE: 423 426 PhabricatorPolicyFilter::requireCapability( 424 427 $this->requireActor(), 425 428 $object, ··· 434 437 435 438 $type = $u->getTransactionType(); 436 439 switch ($type) { 437 - case ConpherenceTransaction::TYPE_TITLE: 438 - return $v; 439 440 case ConpherenceTransaction::TYPE_PARTICIPANTS: 440 441 return $this->mergePHIDOrEdgeTransactions($u, $v); 441 442 } ··· 541 542 return PhabricatorEnv::getEnvConfig('metamta.conpherence.subject-prefix'); 542 543 } 543 544 544 - protected function shouldPublishFeedStory( 545 - PhabricatorLiskDAO $object, 546 - array $xactions) { 547 - 548 - foreach ($xactions as $xaction) { 549 - switch ($xaction->getTransactionType()) { 550 - case ConpherenceTransaction::TYPE_TITLE: 551 - case ConpherenceTransaction::TYPE_TOPIC: 552 - case ConpherenceTransaction::TYPE_PICTURE: 553 - return true; 554 - default: 555 - return false; 556 - } 557 - } 558 - return false; 559 - } 560 - 561 545 protected function supportsSearch() { 562 546 return true; 563 547 } ··· 570 554 $errors = parent::validateTransaction($object, $type, $xactions); 571 555 572 556 switch ($type) { 573 - case ConpherenceTransaction::TYPE_TITLE: 574 - if (empty($xactions)) { 575 - break; 576 - } 577 - $missing = $this->validateIsEmptyTextField( 578 - $object->getTitle(), 579 - $xactions); 580 - 581 - if ($missing) { 582 - $detail = pht('Room title is required.'); 583 - $error = new PhabricatorApplicationTransactionValidationError( 584 - $type, 585 - pht('Required'), 586 - $detail, 587 - last($xactions)); 588 - 589 - $error->setIsMissingFieldError(true); 590 - $errors[] = $error; 591 - } 592 - break; 593 557 case ConpherenceTransaction::TYPE_PARTICIPANTS: 594 558 foreach ($xactions as $xaction) { 595 559 $new_phids = $this->getPHIDTransactionNewValue($xaction, array());
+3 -3
src/applications/conpherence/storage/ConpherenceThread.php
··· 268 268 case PhabricatorTransactions::TYPE_COMMENT: 269 269 $message_transaction = $transaction; 270 270 break; 271 - case ConpherenceTransaction::TYPE_TITLE: 272 - case ConpherenceTransaction::TYPE_TOPIC: 273 - case ConpherenceTransaction::TYPE_PICTURE: 271 + case ConpherenceThreadTitleTransaction::TRANSACTIONTYPE: 272 + case ConpherenceThreadTopicTransaction::TRANSACTIONTYPE: 273 + case ConpherenceThreadPictureTransaction::TRANSACTIONTYPE: 274 274 case ConpherenceTransaction::TYPE_PARTICIPANTS: 275 275 $action_transaction = $transaction; 276 276 break;
+6 -100
src/applications/conpherence/storage/ConpherenceTransaction.php
··· 1 1 <?php 2 2 3 - final class ConpherenceTransaction extends PhabricatorApplicationTransaction { 3 + final class ConpherenceTransaction 4 + extends PhabricatorModularTransaction { 4 5 5 - const TYPE_TITLE = 'title'; 6 - const TYPE_TOPIC = 'topic'; 7 6 const TYPE_PARTICIPANTS = 'participants'; 8 7 const TYPE_DATE_MARKER = 'date-marker'; 9 - const TYPE_PICTURE = 'picture'; 10 8 11 9 public function getApplicationName() { 12 10 return 'conpherence'; ··· 20 18 return new ConpherenceTransactionComment(); 21 19 } 22 20 21 + public function getBaseTransactionClass() { 22 + return 'ConpherenceThreadTransactionType'; 23 + } 24 + 23 25 public function getNoEffectDescription() { 24 26 switch ($this->getTransactionType()) { 25 27 case self::TYPE_PARTICIPANTS: ··· 37 39 switch ($this->getTransactionType()) { 38 40 case self::TYPE_PARTICIPANTS: 39 41 return ($old === null); 40 - case self::TYPE_TITLE: 41 - case self::TYPE_TOPIC: 42 - case self::TYPE_PICTURE: 43 42 case self::TYPE_DATE_MARKER: 44 43 return false; 45 44 } ··· 54 53 $new = $this->getNewValue(); 55 54 56 55 switch ($this->getTransactionType()) { 57 - case self::TYPE_TITLE: 58 - case self::TYPE_TOPIC: 59 56 case PhabricatorTransactions::TYPE_VIEW_POLICY: 60 57 case PhabricatorTransactions::TYPE_EDIT_POLICY: 61 58 case PhabricatorTransactions::TYPE_JOIN_POLICY: 62 - case self::TYPE_PICTURE: 63 59 return $this->getRoomTitle(); 64 60 break; 65 61 case self::TYPE_PARTICIPANTS: ··· 94 90 return parent::getTitle(); 95 91 } 96 92 97 - public function getTitleForFeed() { 98 - $author_phid = $this->getAuthorPHID(); 99 - $object_phid = $this->getObjectPHID(); 100 - 101 - $old = $this->getOldValue(); 102 - $new = $this->getNewValue(); 103 - 104 - $type = $this->getTransactionType(); 105 - switch ($type) { 106 - case self::TYPE_TITLE: 107 - if (strlen($old) && strlen($new)) { 108 - return pht( 109 - '%s renamed %s from "%s" to "%s".', 110 - $this->renderHandleLink($author_phid), 111 - $this->renderHandleLink($object_phid), 112 - $old, 113 - $new); 114 - } else { 115 - return pht( 116 - '%s created the room %s.', 117 - $this->renderHandleLink($author_phid), 118 - $this->renderHandleLink($object_phid)); 119 - } 120 - break; 121 - break; 122 - case self::TYPE_TOPIC: 123 - if (strlen($new)) { 124 - return pht( 125 - '%s set the topic of %s to "%s".', 126 - $this->renderHandleLink($author_phid), 127 - $this->renderHandleLink($object_phid), 128 - $new); 129 - } else if (strlen($old)) { 130 - return pht( 131 - '%s deleted the topic in %s', 132 - $this->renderHandleLink($author_phid), 133 - $this->renderHandleLink($object_phid)); 134 - } 135 - break; 136 - case self::TYPE_PICTURE: 137 - return pht( 138 - '%s updated the room image for %s.', 139 - $this->renderHandleLink($author_phid), 140 - $this->renderHandleLink($object_phid)); 141 - break; 142 - } 143 - return parent::getTitleForFeed(); 144 - } 145 - 146 93 private function getRoomTitle() { 147 94 $author_phid = $this->getAuthorPHID(); 148 95 ··· 150 97 $new = $this->getNewValue(); 151 98 152 99 switch ($this->getTransactionType()) { 153 - case self::TYPE_TITLE: 154 - if ($old && $new) { 155 - $title = pht( 156 - '%s renamed this room from "%s" to "%s".', 157 - $this->renderHandleLink($author_phid), 158 - $old, 159 - $new); 160 - } else if ($old) { 161 - $title = pht( 162 - '%s deleted the room name "%s".', 163 - $this->renderHandleLink($author_phid), 164 - $old); 165 - } else { 166 - $title = pht( 167 - '%s named this room "%s".', 168 - $this->renderHandleLink($author_phid), 169 - $new); 170 - } 171 - return $title; 172 - break; 173 - case self::TYPE_TOPIC: 174 - if ($new) { 175 - $title = pht( 176 - '%s set the topic of this room to "%s".', 177 - $this->renderHandleLink($author_phid), 178 - $new); 179 - } else if ($old) { 180 - $title = pht( 181 - '%s deleted the room topic "%s"', 182 - $this->renderHandleLink($author_phid), 183 - $old); 184 - } 185 - return $title; 186 - break; 187 - case self::TYPE_PICTURE: 188 - return pht( 189 - '%s updated the room image.', 190 - $this->renderHandleLink($author_phid)); 191 - break; 192 100 case PhabricatorTransactions::TYPE_VIEW_POLICY: 193 101 return pht( 194 102 '%s changed the visibility of this room from "%s" to "%s".', ··· 221 129 222 130 $phids[] = $this->getAuthorPHID(); 223 131 switch ($this->getTransactionType()) { 224 - case self::TYPE_TITLE: 225 - case self::TYPE_PICTURE: 226 132 case self::TYPE_DATE_MARKER: 227 133 break; 228 134 case self::TYPE_PARTICIPANTS:
+4 -11
src/applications/conpherence/view/ConpherenceTransactionView.php
··· 216 216 $content = null; 217 217 $handles = $this->getHandles(); 218 218 switch ($transaction->getTransactionType()) { 219 - case ConpherenceTransaction::TYPE_TITLE: 220 - case ConpherenceTransaction::TYPE_TOPIC: 221 - case ConpherenceTransaction::TYPE_PICTURE: 222 - case ConpherenceTransaction::TYPE_PARTICIPANTS: 223 - case PhabricatorTransactions::TYPE_VIEW_POLICY: 224 - case PhabricatorTransactions::TYPE_EDIT_POLICY: 225 - case PhabricatorTransactions::TYPE_JOIN_POLICY: 226 - case PhabricatorTransactions::TYPE_EDGE: 227 - $content = $transaction->getTitle(); 228 - $this->addClass('conpherence-edited'); 229 - break; 230 219 case PhabricatorTransactions::TYPE_COMMENT: 231 220 $this->addClass('conpherence-comment'); 232 221 $author = $handles[$transaction->getAuthorPHID()]; ··· 235 224 $comment, 236 225 PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT); 237 226 $content_class = 'conpherence-message'; 227 + break; 228 + default: 229 + $content = $transaction->getTitle(); 230 + $this->addClass('conpherence-edited'); 238 231 break; 239 232 } 240 233
+29
src/applications/conpherence/xaction/ConpherenceThreadPictureTransaction.php
··· 1 + <?php 2 + 3 + final class ConpherenceThreadPictureTransaction 4 + extends ConpherenceThreadTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'picture'; 7 + 8 + public function generateOldValue($object) { 9 + return $object->getProfileImagePHID(); 10 + } 11 + 12 + public function applyInternalEffects($object, $value) { 13 + $object->setProfileImagePHID($value); 14 + } 15 + 16 + public function getTitle() { 17 + return pht( 18 + '%s updated the room image.', 19 + $this->renderAuthor()); 20 + } 21 + 22 + public function getTitleForFeed() { 23 + return pht( 24 + '%s updated the room image for %s.', 25 + $this->renderAuthor(), 26 + $this->renderObject()); 27 + } 28 + 29 + }
+75
src/applications/conpherence/xaction/ConpherenceThreadTitleTransaction.php
··· 1 + <?php 2 + 3 + final class ConpherenceThreadTitleTransaction 4 + extends ConpherenceThreadTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'title'; 7 + 8 + public function generateOldValue($object) { 9 + return $object->getTitle(); 10 + } 11 + 12 + public function applyInternalEffects($object, $value) { 13 + $object->setTitle($value); 14 + } 15 + 16 + public function getTitle() { 17 + $old = $this->getOldValue(); 18 + $new = $this->getNewValue(); 19 + 20 + if (strlen($old) && strlen($new)) { 21 + return pht( 22 + '%s renamed this room from %s to %s.', 23 + $this->renderAuthor(), 24 + $this->renderOldValue(), 25 + $this->renderNewValue()); 26 + } else { 27 + return pht( 28 + '%s created this room.', 29 + $this->renderAuthor()); 30 + } 31 + } 32 + 33 + public function getTitleForFeed() { 34 + $old = $this->getOldValue(); 35 + $new = $this->getNewValue(); 36 + 37 + if (strlen($old) && strlen($new)) { 38 + return pht( 39 + '%s renamed %s from %s to %s.', 40 + $this->renderAuthor(), 41 + $this->renderObject(), 42 + $this->renderOldValue(), 43 + $this->renderNewValue()); 44 + } else { 45 + return pht( 46 + '%s created %s.', 47 + $this->renderAuthor(), 48 + $this->renderObject()); 49 + } 50 + } 51 + 52 + 53 + public function validateTransactions($object, array $xactions) { 54 + $errors = array(); 55 + 56 + if ($this->isEmptyTextTransaction($object->getTitle(), $xactions)) { 57 + $errors[] = $this->newRequiredError( 58 + pht('Rooms must have a title.')); 59 + } 60 + 61 + $max_length = $object->getColumnMaximumByteLength('title'); 62 + foreach ($xactions as $xaction) { 63 + $new_value = $xaction->getNewValue(); 64 + $new_length = strlen($new_value); 65 + if ($new_length > $max_length) { 66 + $errors[] = $this->newInvalidError( 67 + pht('The title can be no longer than %s characters.', 68 + new PhutilNumber($max_length))); 69 + } 70 + } 71 + 72 + return $errors; 73 + } 74 + 75 + }
+69
src/applications/conpherence/xaction/ConpherenceThreadTopicTransaction.php
··· 1 + <?php 2 + 3 + final class ConpherenceThreadTopicTransaction 4 + extends ConpherenceThreadTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'topic'; 7 + 8 + public function generateOldValue($object) { 9 + return $object->getTopic(); 10 + } 11 + 12 + public function applyInternalEffects($object, $value) { 13 + $object->setTopic($value); 14 + } 15 + 16 + public function getTitle() { 17 + $old = $this->getOldValue(); 18 + $new = $this->getNewValue(); 19 + 20 + if (strlen($new)) { 21 + return pht( 22 + '%s set the room topic to %s.', 23 + $this->renderAuthor(), 24 + $this->renderNewValue()); 25 + } else { 26 + return pht( 27 + '%s removed the room topic.', 28 + $this->renderAuthor()); 29 + } 30 + 31 + } 32 + 33 + public function getTitleForFeed() { 34 + $old = $this->getOldValue(); 35 + $new = $this->getNewValue(); 36 + 37 + if (strlen($new)) { 38 + return pht( 39 + '%s set the room topic to %s in %s.', 40 + $this->renderAuthor(), 41 + $this->renderNewValue(), 42 + $this->renderObject()); 43 + } else { 44 + return pht( 45 + '%s removed the room topic for %s.', 46 + $this->renderAuthor(), 47 + $this->renderObject()); 48 + } 49 + 50 + } 51 + 52 + public function validateTransactions($object, array $xactions) { 53 + $errors = array(); 54 + 55 + $max_length = $object->getColumnMaximumByteLength('topic'); 56 + foreach ($xactions as $xaction) { 57 + $new_value = $xaction->getNewValue(); 58 + $new_length = strlen($new_value); 59 + if ($new_length > $max_length) { 60 + $errors[] = $this->newInvalidError( 61 + pht('The topic can be no longer than %s characters.', 62 + new PhutilNumber($max_length))); 63 + } 64 + } 65 + 66 + return $errors; 67 + } 68 + 69 + }
+4
src/applications/conpherence/xaction/ConpherenceThreadTransactionType.php
··· 1 + <?php 2 + 3 + abstract class ConpherenceThreadTransactionType 4 + extends PhabricatorModularTransactionType {}
+3 -1
webroot/rsrc/css/phui/phui-timeline-view.css
··· 256 256 color: {$lightgreytext}; 257 257 } 258 258 259 - .phui-timeline-title .phui-timeline-value { 259 + .phui-timeline-title .phui-timeline-value, 260 + .conpherence-transaction-content .phui-timeline-value, 261 + .phui-feed-story-head .phui-timeline-value { 260 262 font-style: italic; 261 263 color: black; 262 264 }