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

Allow inline comment storage objects to generate their own runtime objects

Summary:
Ref T13513. Currently, inline storage objects ("TransactionComment") can't directly generate a runtime object ("InlineComment").

Allow this transformation to be performed in a genric way so clunky code which does it per-object-type can be removed, lifted, or simplified.

Simplify an especially gross callsite in preview code.

Test Plan: Previewed inline comments.

Maniphest Tasks: T13513

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

+41 -23
+9 -9
resources/celerity/map.php
··· 13 13 'core.pkg.js' => '1e667bcb', 14 14 'dark-console.pkg.js' => '187792c2', 15 15 'differential.pkg.css' => '2d70b7b9', 16 - 'differential.pkg.js' => '22ec6f26', 16 + 'differential.pkg.js' => 'faa6e8ab', 17 17 'diffusion.pkg.css' => '42c75c37', 18 18 'diffusion.pkg.js' => 'a98c0bf7', 19 19 'maniphest.pkg.css' => '35995d6d', ··· 433 433 'rsrc/js/application/releeph/releeph-preview-branch.js' => '75184d68', 434 434 'rsrc/js/application/releeph/releeph-request-state-change.js' => '9f081f05', 435 435 'rsrc/js/application/releeph/releeph-request-typeahead.js' => 'aa3a100c', 436 - 'rsrc/js/application/repository/repository-crossreference.js' => '1c95ea63', 436 + 'rsrc/js/application/repository/repository-crossreference.js' => '6337cf26', 437 437 'rsrc/js/application/search/behavior-reorder-profile-menu-items.js' => 'e5bdb730', 438 438 'rsrc/js/application/search/behavior-reorder-queries.js' => 'b86f297f', 439 439 'rsrc/js/application/transactions/behavior-comment-actions.js' => '4dffaeb2', ··· 685 685 'javelin-behavior-reorder-applications' => 'aa371860', 686 686 'javelin-behavior-reorder-columns' => '8ac32fd9', 687 687 'javelin-behavior-reorder-profile-menu-items' => 'e5bdb730', 688 - 'javelin-behavior-repository-crossreference' => '1c95ea63', 688 + 'javelin-behavior-repository-crossreference' => '6337cf26', 689 689 'javelin-behavior-scrollbar' => '92388bae', 690 690 'javelin-behavior-search-reorder-queries' => 'b86f297f', 691 691 'javelin-behavior-select-content' => 'e8240b50', ··· 1049 1049 'javelin-install', 1050 1050 'javelin-util', 1051 1051 ), 1052 - '1c95ea63' => array( 1053 - 'javelin-behavior', 1054 - 'javelin-dom', 1055 - 'javelin-stratcom', 1056 - 'javelin-uri', 1057 - ), 1058 1052 '1cab0e9a' => array( 1059 1053 'javelin-behavior', 1060 1054 'javelin-dom', ··· 1500 1494 ), 1501 1495 '60cd9241' => array( 1502 1496 'javelin-behavior', 1497 + ), 1498 + '6337cf26' => array( 1499 + 'javelin-behavior', 1500 + 'javelin-dom', 1501 + 'javelin-stratcom', 1502 + 'javelin-uri', 1503 1503 ), 1504 1504 '65bb0011' => array( 1505 1505 'javelin-behavior',
+9 -2
src/__phutil_library_map__.php
··· 3593 3593 'PhabricatorInfrastructureTestCase' => '__tests__/PhabricatorInfrastructureTestCase.php', 3594 3594 'PhabricatorInlineComment' => 'infrastructure/diff/interface/PhabricatorInlineComment.php', 3595 3595 'PhabricatorInlineCommentController' => 'infrastructure/diff/PhabricatorInlineCommentController.php', 3596 + 'PhabricatorInlineCommentInterface' => 'applications/transactions/interface/PhabricatorInlineCommentInterface.php', 3596 3597 'PhabricatorInlineSummaryView' => 'infrastructure/diff/view/PhabricatorInlineSummaryView.php', 3597 3598 'PhabricatorInstructionsEditField' => 'applications/transactions/editfield/PhabricatorInstructionsEditField.php', 3598 3599 'PhabricatorIntConfigType' => 'applications/config/type/PhabricatorIntConfigType.php', ··· 6789 6790 'DifferentialTestPlanField' => 'DifferentialCoreCustomField', 6790 6791 'DifferentialTitleCommitMessageField' => 'DifferentialCommitMessageField', 6791 6792 'DifferentialTransaction' => 'PhabricatorModularTransaction', 6792 - 'DifferentialTransactionComment' => 'PhabricatorApplicationTransactionComment', 6793 + 'DifferentialTransactionComment' => array( 6794 + 'PhabricatorApplicationTransactionComment', 6795 + 'PhabricatorInlineCommentInterface', 6796 + ), 6793 6797 'DifferentialTransactionEditor' => 'PhabricatorApplicationTransactionEditor', 6794 6798 'DifferentialTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 6795 6799 'DifferentialTransactionView' => 'PhabricatorApplicationTransactionView', ··· 8599 8603 'PhabricatorAuditStatusConstants' => 'Phobject', 8600 8604 'PhabricatorAuditSynchronizeManagementWorkflow' => 'PhabricatorAuditManagementWorkflow', 8601 8605 'PhabricatorAuditTransaction' => 'PhabricatorModularTransaction', 8602 - 'PhabricatorAuditTransactionComment' => 'PhabricatorApplicationTransactionComment', 8606 + 'PhabricatorAuditTransactionComment' => array( 8607 + 'PhabricatorApplicationTransactionComment', 8608 + 'PhabricatorInlineCommentInterface', 8609 + ), 8603 8610 'PhabricatorAuditTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 8604 8611 'PhabricatorAuditTransactionView' => 'PhabricatorApplicationTransactionView', 8605 8612 'PhabricatorAuditUpdateOwnersManagementWorkflow' => 'PhabricatorAuditManagementWorkflow',
+7 -1
src/applications/audit/storage/PhabricatorAuditTransactionComment.php
··· 1 1 <?php 2 2 3 3 final class PhabricatorAuditTransactionComment 4 - extends PhabricatorApplicationTransactionComment { 4 + extends PhabricatorApplicationTransactionComment 5 + implements 6 + PhabricatorInlineCommentInterface { 5 7 6 8 protected $commitPHID; 7 9 protected $pathID; ··· 83 85 84 86 public function isEmptyInlineComment() { 85 87 return !strlen($this->getContent()); 88 + } 89 + 90 + public function newInlineCommentObject() { 91 + return PhabricatorAuditInlineComment::newFromModernComment($this); 86 92 } 87 93 88 94 }
+7 -1
src/applications/differential/storage/DifferentialTransactionComment.php
··· 1 1 <?php 2 2 3 3 final class DifferentialTransactionComment 4 - extends PhabricatorApplicationTransactionComment { 4 + extends PhabricatorApplicationTransactionComment 5 + implements 6 + PhabricatorInlineCommentInterface { 5 7 6 8 protected $revisionPHID; 7 9 protected $changesetID; ··· 129 131 130 132 public function isEmptyInlineComment() { 131 133 return !strlen($this->getContent()); 134 + } 135 + 136 + public function newInlineCommentObject() { 137 + return DifferentialInlineComment::newFromModernComment($this); 132 138 } 133 139 134 140 }
+7
src/applications/transactions/interface/PhabricatorInlineCommentInterface.php
··· 1 + <?php 2 + 3 + interface PhabricatorInlineCommentInterface { 4 + 5 + public function newInlineCommentObject(); 6 + 7 + }
+1 -9
src/infrastructure/diff/view/PHUIDiffInlineCommentPreviewListView.php
··· 38 38 39 39 $inlines = $this->getInlineComments(); 40 40 foreach ($inlines as $key => $inline) { 41 - // TODO: This is real, real gross. 42 - 43 - if ($inline instanceof DifferentialTransactionComment) { 44 - $inlines[$key] = DifferentialInlineComment::newFromModernComment( 45 - $inline); 46 - } else { 47 - $inlines[$key] = PhabricatorAuditInlineComment::newFromModernComment( 48 - $inline); 49 - } 41 + $inlines[$key] = $inline->newInlineCommentObject(); 50 42 } 51 43 52 44 $engine = new PhabricatorMarkupEngine();
+1 -1
webroot/rsrc/js/application/repository/repository-crossreference.js
··· 219 219 } 220 220 221 221 function getPath(target) { 222 - // This method works in Differential, when browsing a changset. 222 + // This method works in Differential, when browsing a changeset. 223 223 var changeset; 224 224 try { 225 225 changeset = JX.DOM.findAbove(target, 'div', 'differential-changeset');