@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 basic feed stories for Conpherence

Summary: [Draft] Posting this up because feed is pulling `getTitle` and not `getTitleForFeed` and I'm super confused. Restarted phd and apache.

Test Plan: Create a new room, see link in feed. Change topic, see story, add people, don't see story.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T11645

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

+64 -4
+4 -4
src/applications/conpherence/controller/ConpherenceNewRoomController.php
··· 16 16 $editor = new ConpherenceEditor(); 17 17 $xactions = array(); 18 18 19 + $xactions[] = id(new ConpherenceTransaction()) 20 + ->setTransactionType(ConpherenceTransaction::TYPE_TITLE) 21 + ->setNewValue($request->getStr('title')); 22 + 19 23 $participants = $request->getArr('participants'); 20 24 $participants[] = $user->getPHID(); 21 25 $participants = array_unique($participants); 22 26 $xactions[] = id(new ConpherenceTransaction()) 23 27 ->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS) 24 28 ->setNewValue(array('+' => $participants)); 25 - 26 - $xactions[] = id(new ConpherenceTransaction()) 27 - ->setTransactionType(ConpherenceTransaction::TYPE_TITLE) 28 - ->setNewValue($request->getStr('title')); 29 29 $xactions[] = id(new ConpherenceTransaction()) 30 30 ->setTransactionType(ConpherenceTransaction::TYPE_TOPIC) 31 31 ->setNewValue($request->getStr('topic'));
+11
src/applications/conpherence/editor/ConpherenceEditor.php
··· 623 623 protected function shouldPublishFeedStory( 624 624 PhabricatorLiskDAO $object, 625 625 array $xactions) { 626 + 627 + foreach ($xactions as $xaction) { 628 + switch ($xaction->getTransactionType()) { 629 + case ConpherenceTransaction::TYPE_TITLE: 630 + case ConpherenceTransaction::TYPE_TOPIC: 631 + case ConpherenceTransaction::TYPE_PICTURE: 632 + return true; 633 + default: 634 + return false; 635 + } 636 + } 626 637 return false; 627 638 } 628 639
+49
src/applications/conpherence/storage/ConpherenceTransaction.php
··· 123 123 return parent::getTitle(); 124 124 } 125 125 126 + public function getTitleForFeed() { 127 + $author_phid = $this->getAuthorPHID(); 128 + $object_phid = $this->getObjectPHID(); 129 + 130 + $old = $this->getOldValue(); 131 + $new = $this->getNewValue(); 132 + 133 + $type = $this->getTransactionType(); 134 + switch ($type) { 135 + case self::TYPE_TITLE: 136 + if (strlen($old) && strlen($new)) { 137 + return pht( 138 + '%s renamed %s from "%s" to "%s".', 139 + $this->renderHandleLink($author_phid), 140 + $this->renderHandleLink($object_phid), 141 + $old, 142 + $new); 143 + } else { 144 + return pht( 145 + '%s created the room %s.', 146 + $this->renderHandleLink($author_phid), 147 + $this->renderHandleLink($object_phid)); 148 + } 149 + break; 150 + break; 151 + case self::TYPE_TOPIC: 152 + if (strlen($new)) { 153 + return pht( 154 + '%s set the topic of %s to "%s".', 155 + $this->renderHandleLink($author_phid), 156 + $this->renderHandleLink($object_phid), 157 + $new); 158 + } else if (strlen($old)) { 159 + return pht( 160 + '%s deleted the topic in %s', 161 + $this->renderHandleLink($author_phid), 162 + $this->renderHandleLink($object_phid)); 163 + } 164 + break; 165 + case self::TYPE_PICTURE: 166 + return pht( 167 + '%s updated the room image for %s.', 168 + $this->renderHandleLink($author_phid), 169 + $this->renderHandleLink($object_phid)); 170 + break; 171 + } 172 + return parent::getTitleForFeed(); 173 + } 174 + 126 175 private function getRoomTitle() { 127 176 $author_phid = $this->getAuthorPHID(); 128 177