Commit 1656a2ff authored by epriestley's avatar epriestley
Browse files

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
parent 39764885
......@@ -13,7 +13,7 @@ return array(
'core.pkg.js' => '1e667bcb',
'dark-console.pkg.js' => '187792c2',
'differential.pkg.css' => '2d70b7b9',
'differential.pkg.js' => '22ec6f26',
'differential.pkg.js' => 'faa6e8ab',
'diffusion.pkg.css' => '42c75c37',
'diffusion.pkg.js' => 'a98c0bf7',
'maniphest.pkg.css' => '35995d6d',
......@@ -433,7 +433,7 @@ return array(
'rsrc/js/application/releeph/releeph-preview-branch.js' => '75184d68',
'rsrc/js/application/releeph/releeph-request-state-change.js' => '9f081f05',
'rsrc/js/application/releeph/releeph-request-typeahead.js' => 'aa3a100c',
'rsrc/js/application/repository/repository-crossreference.js' => '1c95ea63',
'rsrc/js/application/repository/repository-crossreference.js' => '6337cf26',
'rsrc/js/application/search/behavior-reorder-profile-menu-items.js' => 'e5bdb730',
'rsrc/js/application/search/behavior-reorder-queries.js' => 'b86f297f',
'rsrc/js/application/transactions/behavior-comment-actions.js' => '4dffaeb2',
......@@ -685,7 +685,7 @@ return array(
'javelin-behavior-reorder-applications' => 'aa371860',
'javelin-behavior-reorder-columns' => '8ac32fd9',
'javelin-behavior-reorder-profile-menu-items' => 'e5bdb730',
'javelin-behavior-repository-crossreference' => '1c95ea63',
'javelin-behavior-repository-crossreference' => '6337cf26',
'javelin-behavior-scrollbar' => '92388bae',
'javelin-behavior-search-reorder-queries' => 'b86f297f',
'javelin-behavior-select-content' => 'e8240b50',
......@@ -1049,12 +1049,6 @@ return array(
'javelin-install',
'javelin-util',
),
'1c95ea63' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-uri',
),
'1cab0e9a' => array(
'javelin-behavior',
'javelin-dom',
......@@ -1501,6 +1495,12 @@ return array(
'60cd9241' => array(
'javelin-behavior',
),
'6337cf26' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-uri',
),
'65bb0011' => array(
'javelin-behavior',
'javelin-dom',
......
......@@ -3593,6 +3593,7 @@ phutil_register_library_map(array(
'PhabricatorInfrastructureTestCase' => '__tests__/PhabricatorInfrastructureTestCase.php',
'PhabricatorInlineComment' => 'infrastructure/diff/interface/PhabricatorInlineComment.php',
'PhabricatorInlineCommentController' => 'infrastructure/diff/PhabricatorInlineCommentController.php',
'PhabricatorInlineCommentInterface' => 'applications/transactions/interface/PhabricatorInlineCommentInterface.php',
'PhabricatorInlineSummaryView' => 'infrastructure/diff/view/PhabricatorInlineSummaryView.php',
'PhabricatorInstructionsEditField' => 'applications/transactions/editfield/PhabricatorInstructionsEditField.php',
'PhabricatorIntConfigType' => 'applications/config/type/PhabricatorIntConfigType.php',
......@@ -6789,7 +6790,10 @@ phutil_register_library_map(array(
'DifferentialTestPlanField' => 'DifferentialCoreCustomField',
'DifferentialTitleCommitMessageField' => 'DifferentialCommitMessageField',
'DifferentialTransaction' => 'PhabricatorModularTransaction',
'DifferentialTransactionComment' => 'PhabricatorApplicationTransactionComment',
'DifferentialTransactionComment' => array(
'PhabricatorApplicationTransactionComment',
'PhabricatorInlineCommentInterface',
),
'DifferentialTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
'DifferentialTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'DifferentialTransactionView' => 'PhabricatorApplicationTransactionView',
......@@ -8599,7 +8603,10 @@ phutil_register_library_map(array(
'PhabricatorAuditStatusConstants' => 'Phobject',
'PhabricatorAuditSynchronizeManagementWorkflow' => 'PhabricatorAuditManagementWorkflow',
'PhabricatorAuditTransaction' => 'PhabricatorModularTransaction',
'PhabricatorAuditTransactionComment' => 'PhabricatorApplicationTransactionComment',
'PhabricatorAuditTransactionComment' => array(
'PhabricatorApplicationTransactionComment',
'PhabricatorInlineCommentInterface',
),
'PhabricatorAuditTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorAuditTransactionView' => 'PhabricatorApplicationTransactionView',
'PhabricatorAuditUpdateOwnersManagementWorkflow' => 'PhabricatorAuditManagementWorkflow',
<?php
final class PhabricatorAuditTransactionComment
extends PhabricatorApplicationTransactionComment {
extends PhabricatorApplicationTransactionComment
implements
PhabricatorInlineCommentInterface {
protected $commitPHID;
protected $pathID;
......@@ -85,4 +87,8 @@ final class PhabricatorAuditTransactionComment
return !strlen($this->getContent());
}
public function newInlineCommentObject() {
return PhabricatorAuditInlineComment::newFromModernComment($this);
}
}
<?php
final class DifferentialTransactionComment
extends PhabricatorApplicationTransactionComment {
extends PhabricatorApplicationTransactionComment
implements
PhabricatorInlineCommentInterface {
protected $revisionPHID;
protected $changesetID;
......@@ -131,4 +133,8 @@ final class DifferentialTransactionComment
return !strlen($this->getContent());
}
public function newInlineCommentObject() {
return DifferentialInlineComment::newFromModernComment($this);
}
}
<?php
interface PhabricatorInlineCommentInterface {
public function newInlineCommentObject();
}
......@@ -38,15 +38,7 @@ final class PHUIDiffInlineCommentPreviewListView
$inlines = $this->getInlineComments();
foreach ($inlines as $key => $inline) {
// TODO: This is real, real gross.
if ($inline instanceof DifferentialTransactionComment) {
$inlines[$key] = DifferentialInlineComment::newFromModernComment(
$inline);
} else {
$inlines[$key] = PhabricatorAuditInlineComment::newFromModernComment(
$inline);
}
$inlines[$key] = $inline->newInlineCommentObject();
}
$engine = new PhabricatorMarkupEngine();
......
......@@ -219,7 +219,7 @@ JX.behavior('repository-crossreference', function(config, statics) {
}
function getPath(target) {
// This method works in Differential, when browsing a changset.
// This method works in Differential, when browsing a changeset.
var changeset;
try {
changeset = JX.DOM.findAbove(target, 'div', 'differential-changeset');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment