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

Migrate Pholio inline comments to modular transactions

Summary: Fixes T12626.

Test Plan: Made lots of comments, confirmed no UI changes

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Maniphest Tasks: T12626

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

+45 -81
+2
src/__phutil_library_map__.php
··· 4401 4401 'PholioMockHeraldField' => 'applications/pholio/herald/PholioMockHeraldField.php', 4402 4402 'PholioMockHeraldFieldGroup' => 'applications/pholio/herald/PholioMockHeraldFieldGroup.php', 4403 4403 'PholioMockImagesView' => 'applications/pholio/view/PholioMockImagesView.php', 4404 + 'PholioMockInlineTransaction' => 'applications/pholio/xaction/PholioMockInlineTransaction.php', 4404 4405 'PholioMockListController' => 'applications/pholio/controller/PholioMockListController.php', 4405 4406 'PholioMockMailReceiver' => 'applications/pholio/mail/PholioMockMailReceiver.php', 4406 4407 'PholioMockNameHeraldField' => 'applications/pholio/herald/PholioMockNameHeraldField.php', ··· 9981 9982 'PholioMockHeraldField' => 'HeraldField', 9982 9983 'PholioMockHeraldFieldGroup' => 'HeraldFieldGroup', 9983 9984 'PholioMockImagesView' => 'AphrontView', 9985 + 'PholioMockInlineTransaction' => 'PholioMockTransactionType', 9984 9986 'PholioMockListController' => 'PholioController', 9985 9987 'PholioMockMailReceiver' => 'PhabricatorObjectMailReceiver', 9986 9988 'PholioMockNameHeraldField' => 'PholioMockHeraldField',
+1 -1
src/applications/pholio/controller/PholioMockCommentController.php
··· 45 45 46 46 foreach ($inline_comments as $inline_comment) { 47 47 $xactions[] = id(new PholioTransaction()) 48 - ->setTransactionType(PholioTransaction::TYPE_INLINE) 48 + ->setTransactionType(PholioMockInlineTransaction::TRANSACTIONTYPE) 49 49 ->attachComment($inline_comment); 50 50 } 51 51
+3 -17
src/applications/pholio/editor/PholioMockEditor.php
··· 30 30 $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; 31 31 $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY; 32 32 33 - $types[] = PholioTransaction::TYPE_INLINE; 34 - 35 33 return $types; 36 34 } 37 35 38 - protected function transactionHasEffect( 39 - PhabricatorLiskDAO $object, 40 - PhabricatorApplicationTransaction $xaction) { 41 - 42 - switch ($xaction->getTransactionType()) { 43 - case PholioTransaction::TYPE_INLINE: 44 - return true; 45 - } 46 - 47 - return parent::transactionHasEffect($object, $xaction); 48 - } 49 - 50 36 protected function shouldApplyInitialEffects( 51 37 PhabricatorLiskDAO $object, 52 38 array $xactions) { ··· 147 133 } 148 134 $comment = $xaction->getComment(); 149 135 switch ($xaction->getTransactionType()) { 150 - case PholioTransaction::TYPE_INLINE: 136 + case PholioMockInlineTransaction::TRANSACTIONTYPE: 151 137 if ($comment && strlen($comment->getContent())) { 152 138 $inline_comments[] = $comment; 153 139 } ··· 237 223 // Move inline comments to the end, so the comments precede them. 238 224 foreach ($xactions as $xaction) { 239 225 $type = $xaction->getTransactionType(); 240 - if ($type == PholioTransaction::TYPE_INLINE) { 226 + if ($type == PholioMockInlineTransaction::TRANSACTIONTYPE) { 241 227 $tail[] = $xaction; 242 228 } else { 243 229 $head[] = $xaction; ··· 252 238 PhabricatorApplicationTransaction $xaction) { 253 239 254 240 switch ($xaction->getTransactionType()) { 255 - case PholioTransaction::TYPE_INLINE: 241 + case PholioMockInlineTransaction::TRANSACTIONTYPE: 256 242 return true; 257 243 } 258 244
+1 -59
src/applications/pholio/storage/PholioTransaction.php
··· 2 2 3 3 final class PholioTransaction extends PhabricatorModularTransaction { 4 4 5 - // Your witty commentary at the mock : image : x,y level 6 - const TYPE_INLINE = 'inline'; 7 - 8 5 const MAILTAG_STATUS = 'pholio-status'; 9 6 const MAILTAG_COMMENT = 'pholio-comment'; 10 7 const MAILTAG_UPDATED = 'pholio-updated'; ··· 30 27 return new PholioTransactionView(); 31 28 } 32 29 33 - public function getIcon() { 34 - switch ($this->getTransactionType()) { 35 - case self::TYPE_INLINE: 36 - return 'fa-comment'; 37 - } 38 - 39 - return parent::getIcon(); 40 - } 41 - 42 30 public function getMailTags() { 43 31 $tags = array(); 44 32 switch ($this->getTransactionType()) { 45 - case self::TYPE_INLINE: 33 + case PholioMockInlineTransaction::TRANSACTIONTYPE: 46 34 case PhabricatorTransactions::TYPE_COMMENT: 47 35 $tags[] = self::MAILTAG_COMMENT; 48 36 break; ··· 63 51 break; 64 52 } 65 53 return $tags; 66 - } 67 - 68 - public function getTitle() { 69 - $author_phid = $this->getAuthorPHID(); 70 - 71 - $old = $this->getOldValue(); 72 - $new = $this->getNewValue(); 73 - 74 - $type = $this->getTransactionType(); 75 - switch ($type) { 76 - case self::TYPE_INLINE: 77 - $count = 1; 78 - foreach ($this->getTransactionGroup() as $xaction) { 79 - if ($xaction->getTransactionType() == $type) { 80 - $count++; 81 - } 82 - } 83 - 84 - return pht( 85 - '%s added %d inline comment(s).', 86 - $this->renderHandleLink($author_phid), 87 - $count); 88 - break; 89 - } 90 - 91 - return parent::getTitle(); 92 - } 93 - 94 - public function getTitleForFeed() { 95 - $author_phid = $this->getAuthorPHID(); 96 - $object_phid = $this->getObjectPHID(); 97 - 98 - $old = $this->getOldValue(); 99 - $new = $this->getNewValue(); 100 - 101 - $type = $this->getTransactionType(); 102 - switch ($type) { 103 - case self::TYPE_INLINE: 104 - return pht( 105 - '%s added an inline comment to %s.', 106 - $this->renderHandleLink($author_phid), 107 - $this->renderHandleLink($object_phid)); 108 - break; 109 - } 110 - 111 - return parent::getTitleForFeed(); 112 54 } 113 55 114 56 }
+5 -4
src/applications/pholio/view/PholioTransactionView.php
··· 30 30 31 31 switch ($u->getTransactionType()) { 32 32 case PhabricatorTransactions::TYPE_COMMENT: 33 - case PholioTransaction::TYPE_INLINE: 33 + case PholioMockInlineTransaction::TRANSACTIONTYPE: 34 34 break; 35 35 default: 36 36 return false; 37 37 } 38 38 39 39 switch ($v->getTransactionType()) { 40 - case PholioTransaction::TYPE_INLINE: 40 + case PholioMockInlineTransaction::TRANSACTIONTYPE: 41 41 return true; 42 42 } 43 43 ··· 50 50 $out = array(); 51 51 52 52 $group = $xaction->getTransactionGroup(); 53 - if ($xaction->getTransactionType() == PholioTransaction::TYPE_INLINE) { 53 + $type = $xaction->getTransactionType(); 54 + if ($type == PholioMockInlineTransaction::TRANSACTIONTYPE) { 54 55 array_unshift($group, $xaction); 55 56 } else { 56 57 $out[] = parent::renderTransactionContent($xaction); ··· 63 64 $inlines = array(); 64 65 foreach ($group as $xaction) { 65 66 switch ($xaction->getTransactionType()) { 66 - case PholioTransaction::TYPE_INLINE: 67 + case PholioMockInlineTransaction::TRANSACTIONTYPE: 67 68 $inlines[] = $xaction; 68 69 break; 69 70 default:
+33
src/applications/pholio/xaction/PholioMockInlineTransaction.php
··· 1 + <?php 2 + 3 + final class PholioMockInlineTransaction 4 + extends PholioMockTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'inline'; 7 + 8 + public function generateOldValue($object) { 9 + return null; 10 + } 11 + 12 + public function getTitle() { 13 + return pht( 14 + '%s added inline comment(s).', 15 + $this->renderAuthor()); 16 + } 17 + 18 + public function getTitleForFeed() { 19 + return pht( 20 + '%s added an inline comment to %s.', 21 + $this->renderAuthor(), 22 + $this->renderObject()); 23 + } 24 + 25 + public function getIcon() { 26 + return 'fa-comment'; 27 + } 28 + 29 + public function getTransactionHasEffect($object, $old, $new) { 30 + return true; 31 + } 32 + 33 + }