Page MenuHomePhabricator

D8354.id.diff
No OneTemporary

D8354.id.diff

Index: src/__phutil_library_map__.php
===================================================================
--- src/__phutil_library_map__.php
+++ src/__phutil_library_map__.php
@@ -322,10 +322,13 @@
'DifferentialActionMenuEventListener' => 'applications/differential/event/DifferentialActionMenuEventListener.php',
'DifferentialAddCommentView' => 'applications/differential/view/DifferentialAddCommentView.php',
'DifferentialAffectedPath' => 'applications/differential/storage/DifferentialAffectedPath.php',
+ 'DifferentialApplyPatchField' => 'applications/differential/customfield/DifferentialApplyPatchField.php',
'DifferentialApplyPatchFieldSpecification' => 'applications/differential/field/specification/DifferentialApplyPatchFieldSpecification.php',
'DifferentialArcanistProjectFieldSpecification' => 'applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php',
+ 'DifferentialAsanaRepresentationField' => 'applications/differential/customfield/DifferentialAsanaRepresentationField.php',
'DifferentialAsanaRepresentationFieldSpecification' => 'applications/differential/field/specification/DifferentialAsanaRepresentationFieldSpecification.php',
'DifferentialAuditorsFieldSpecification' => 'applications/differential/field/specification/DifferentialAuditorsFieldSpecification.php',
+ 'DifferentialAuthorField' => 'applications/differential/customfield/DifferentialAuthorField.php',
'DifferentialAuthorFieldSpecification' => 'applications/differential/field/specification/DifferentialAuthorFieldSpecification.php',
'DifferentialAuxiliaryField' => 'applications/differential/storage/DifferentialAuxiliaryField.php',
'DifferentialBlameRevisionFieldSpecification' => 'applications/differential/field/specification/DifferentialBlameRevisionFieldSpecification.php',
@@ -355,6 +358,7 @@
'DifferentialCommentQuery' => 'applications/differential/query/DifferentialCommentQuery.php',
'DifferentialCommentSaveController' => 'applications/differential/controller/DifferentialCommentSaveController.php',
'DifferentialCommentSaveControllerPro' => 'applications/differential/controller/DifferentialCommentSaveControllerPro.php',
+ 'DifferentialCommitsField' => 'applications/differential/customfield/DifferentialCommitsField.php',
'DifferentialCommitsFieldSpecification' => 'applications/differential/field/specification/DifferentialCommitsFieldSpecification.php',
'DifferentialConflictsFieldSpecification' => 'applications/differential/field/specification/DifferentialConflictsFieldSpecification.php',
'DifferentialController' => 'applications/differential/controller/DifferentialController.php',
@@ -371,7 +375,9 @@
'DifferentialDateCreatedFieldSpecification' => 'applications/differential/field/specification/DifferentialDateCreatedFieldSpecification.php',
'DifferentialDateModifiedFieldSpecification' => 'applications/differential/field/specification/DifferentialDateModifiedFieldSpecification.php',
'DifferentialDefaultFieldSelector' => 'applications/differential/field/selector/DifferentialDefaultFieldSelector.php',
+ 'DifferentialDependenciesField' => 'applications/differential/customfield/DifferentialDependenciesField.php',
'DifferentialDependenciesFieldSpecification' => 'applications/differential/field/specification/DifferentialDependenciesFieldSpecification.php',
+ 'DifferentialDependsOnField' => 'applications/differential/customfield/DifferentialDependsOnField.php',
'DifferentialDependsOnFieldSpecification' => 'applications/differential/field/specification/DifferentialDependsOnFieldSpecification.php',
'DifferentialDiff' => 'applications/differential/storage/DifferentialDiff.php',
'DifferentialDiffContentMail' => 'applications/differential/mail/DifferentialDiffContentMail.php',
@@ -410,6 +416,7 @@
'DifferentialInlineCommentPreviewController' => 'applications/differential/controller/DifferentialInlineCommentPreviewController.php',
'DifferentialInlineCommentQuery' => 'applications/differential/query/DifferentialInlineCommentQuery.php',
'DifferentialInlineCommentView' => 'applications/differential/view/DifferentialInlineCommentView.php',
+ 'DifferentialJIRAIssuesField' => 'applications/differential/customfield/DifferentialJIRAIssuesField.php',
'DifferentialJIRAIssuesFieldSpecification' => 'applications/differential/field/specification/DifferentialJIRAIssuesFieldSpecification.php',
'DifferentialLandingActionMenuEventListener' => 'applications/differential/landing/DifferentialLandingActionMenuEventListener.php',
'DifferentialLandingStrategy' => 'applications/differential/landing/DifferentialLandingStrategy.php',
@@ -422,6 +429,7 @@
'DifferentialLocalCommitsView' => 'applications/differential/view/DifferentialLocalCommitsView.php',
'DifferentialMail' => 'applications/differential/mail/DifferentialMail.php',
'DifferentialMailPhase' => 'applications/differential/constants/DifferentialMailPhase.php',
+ 'DifferentialManiphestTasksField' => 'applications/differential/customfield/DifferentialManiphestTasksField.php',
'DifferentialManiphestTasksFieldSpecification' => 'applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php',
'DifferentialNewDiffMail' => 'applications/differential/mail/DifferentialNewDiffMail.php',
'DifferentialPHIDTypeDiff' => 'applications/differential/phid/DifferentialPHIDTypeDiff.php',
@@ -430,6 +438,7 @@
'DifferentialParseRenderTestCase' => 'applications/differential/__tests__/DifferentialParseRenderTestCase.php',
'DifferentialPathFieldSpecification' => 'applications/differential/field/specification/DifferentialPathFieldSpecification.php',
'DifferentialPrimaryPaneView' => 'applications/differential/view/DifferentialPrimaryPaneView.php',
+ 'DifferentialProjectReviewersField' => 'applications/differential/customfield/DifferentialProjectReviewersField.php',
'DifferentialProjectReviewersFieldSpecification' => 'applications/differential/field/specification/DifferentialProjectReviewersFieldSpecification.php',
'DifferentialRawDiffRenderer' => 'applications/differential/render/DifferentialRawDiffRenderer.php',
'DifferentialReleephRequestFieldSpecification' => 'applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php',
@@ -449,7 +458,6 @@
'DifferentialReviewersView' => 'applications/differential/view/DifferentialReviewersView.php',
'DifferentialRevision' => 'applications/differential/storage/DifferentialRevision.php',
'DifferentialRevisionControlSystem' => 'applications/differential/constants/DifferentialRevisionControlSystem.php',
- 'DifferentialRevisionDetailRenderer' => 'applications/differential/controller/DifferentialRevisionDetailRenderer.php',
'DifferentialRevisionDetailView' => 'applications/differential/view/DifferentialRevisionDetailView.php',
'DifferentialRevisionEditController' => 'applications/differential/controller/DifferentialRevisionEditController.php',
'DifferentialRevisionEditControllerPro' => 'applications/differential/controller/DifferentialRevisionEditControllerPro.php',
@@ -2491,7 +2499,6 @@
'ReleephDiffChurnFieldSpecification' => 'applications/releeph/field/specification/ReleephDiffChurnFieldSpecification.php',
'ReleephDiffMessageFieldSpecification' => 'applications/releeph/field/specification/ReleephDiffMessageFieldSpecification.php',
'ReleephDiffSizeFieldSpecification' => 'applications/releeph/field/specification/ReleephDiffSizeFieldSpecification.php',
- 'ReleephDifferentialRevisionDetailRenderer' => 'applications/releeph/differential/ReleephDifferentialRevisionDetailRenderer.php',
'ReleephFieldParseException' => 'applications/releeph/field/exception/ReleephFieldParseException.php',
'ReleephFieldSelector' => 'applications/releeph/field/selector/ReleephFieldSelector.php',
'ReleephFieldSpecification' => 'applications/releeph/field/specification/ReleephFieldSpecification.php',
@@ -2876,10 +2883,13 @@
'DifferentialActionMenuEventListener' => 'PhabricatorEventListener',
'DifferentialAddCommentView' => 'AphrontView',
'DifferentialAffectedPath' => 'DifferentialDAO',
+ 'DifferentialApplyPatchField' => 'DifferentialCustomField',
'DifferentialApplyPatchFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialArcanistProjectFieldSpecification' => 'DifferentialFieldSpecification',
+ 'DifferentialAsanaRepresentationField' => 'DifferentialCustomField',
'DifferentialAsanaRepresentationFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialAuditorsFieldSpecification' => 'DifferentialFieldSpecification',
+ 'DifferentialAuthorField' => 'DifferentialCustomField',
'DifferentialAuthorFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialAuxiliaryField' => 'DifferentialDAO',
'DifferentialBlameRevisionFieldSpecification' => 'DifferentialFieldSpecification',
@@ -2905,6 +2915,7 @@
'DifferentialCommentQuery' => 'PhabricatorOffsetPagedQuery',
'DifferentialCommentSaveController' => 'DifferentialController',
'DifferentialCommentSaveControllerPro' => 'DifferentialController',
+ 'DifferentialCommitsField' => 'DifferentialCustomField',
'DifferentialCommitsFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialConflictsFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialController' => 'PhabricatorController',
@@ -2921,7 +2932,9 @@
'DifferentialDateCreatedFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialDateModifiedFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialDefaultFieldSelector' => 'DifferentialFieldSelector',
+ 'DifferentialDependenciesField' => 'DifferentialCustomField',
'DifferentialDependenciesFieldSpecification' => 'DifferentialFieldSpecification',
+ 'DifferentialDependsOnField' => 'DifferentialCustomField',
'DifferentialDependsOnFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialDiff' =>
array(
@@ -2961,6 +2974,7 @@
'DifferentialInlineCommentPreviewController' => 'PhabricatorInlineCommentPreviewController',
'DifferentialInlineCommentQuery' => 'PhabricatorOffsetPagedQuery',
'DifferentialInlineCommentView' => 'AphrontView',
+ 'DifferentialJIRAIssuesField' => 'DifferentialCustomField',
'DifferentialJIRAIssuesFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialLandingActionMenuEventListener' => 'PhabricatorEventListener',
'DifferentialLandingToGitHub' => 'DifferentialLandingStrategy',
@@ -2970,6 +2984,7 @@
'DifferentialLintFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialLocalCommitsView' => 'AphrontView',
'DifferentialMail' => 'PhabricatorMail',
+ 'DifferentialManiphestTasksField' => 'DifferentialCustomField',
'DifferentialManiphestTasksFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialNewDiffMail' => 'DifferentialReviewRequestMail',
'DifferentialPHIDTypeDiff' => 'PhabricatorPHIDType',
@@ -2978,6 +2993,7 @@
'DifferentialParseRenderTestCase' => 'PhabricatorTestCase',
'DifferentialPathFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialPrimaryPaneView' => 'AphrontView',
+ 'DifferentialProjectReviewersField' => 'DifferentialCustomField',
'DifferentialProjectReviewersFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialReleephRequestFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialRemarkupRule' => 'PhabricatorRemarkupRuleObject',
Index: src/applications/differential/customfield/DifferentialApplyPatchField.php
===================================================================
--- /dev/null
+++ src/applications/differential/customfield/DifferentialApplyPatchField.php
@@ -0,0 +1,32 @@
+<?php
+
+final class DifferentialApplyPatchField
+ extends DifferentialCustomField {
+
+ public function getFieldKey() {
+ return 'differential:apply-patch';
+ }
+
+ public function getFieldName() {
+ return pht('Apply Patch');
+ }
+
+ public function getFieldDescription() {
+ return pht('Provides instructions for applying a local patch.');
+ }
+
+ public function shouldAppearInPropertyView() {
+ return true;
+ }
+
+ public function renderPropertyViewLabel() {
+ return $this->getFieldName();
+ }
+
+ public function renderPropertyViewValue(array $handles) {
+ $mono = $this->getObject()->getMonogram();
+
+ return phutil_tag('tt', array(), "arc patch {$mono}");
+ }
+
+}
Index: src/applications/differential/customfield/DifferentialAsanaRepresentationField.php
===================================================================
--- /dev/null
+++ src/applications/differential/customfield/DifferentialAsanaRepresentationField.php
@@ -0,0 +1,64 @@
+<?php
+
+final class DifferentialAsanaRepresentationField
+ extends DifferentialCustomField {
+
+ public function getFieldKey() {
+ return 'differential:asana-representation';
+ }
+
+ public function getFieldName() {
+ return pht('In Asana');
+ }
+
+ public function getFieldDescription() {
+ return pht('Shows revision representation in Asana.');
+ }
+
+ public function shouldAppearInPropertyView() {
+ return (bool)PhabricatorEnv::getEnvConfig('asana.workspace-id');
+ }
+
+ public function renderPropertyViewLabel() {
+ return $this->getFieldName();
+ }
+
+ public function renderPropertyViewValue(array $handles) {
+ $viewer = $this->getViewer();
+ $src_phid = $this->getObject()->getPHID();
+ $edge_type = PhabricatorEdgeConfig::TYPE_PHOB_HAS_ASANATASK;
+
+ $query = id(new PhabricatorEdgeQuery())
+ ->withSourcePHIDs(array($src_phid))
+ ->withEdgeTypes(array($edge_type))
+ ->needEdgeData(true);
+
+ $edges = $query->execute();
+ if (!$edges) {
+ return null;
+ }
+
+ $edge = head($edges[$src_phid][$edge_type]);
+
+ if (!empty($edge['data']['gone'])) {
+ return phutil_tag(
+ 'em',
+ array(),
+ pht('Asana Task Deleted'));
+ }
+
+ $ref = id(new DoorkeeperImportEngine())
+ ->setViewer($viewer)
+ ->withPHIDs(array($edge['dst']))
+ ->needLocalOnly(true)
+ ->executeOne();
+
+ if (!$ref) {
+ return null;
+ }
+
+ return id(new DoorkeeperTagView())
+ ->setExternalObject($ref->getExternalObject());
+ }
+
+}
Index: src/applications/differential/customfield/DifferentialAuthorField.php
===================================================================
--- /dev/null
+++ src/applications/differential/customfield/DifferentialAuthorField.php
@@ -0,0 +1,34 @@
+<?php
+
+final class DifferentialAuthorField
+ extends DifferentialCustomField {
+
+ public function getFieldKey() {
+ return 'differential:author';
+ }
+
+ public function getFieldName() {
+ return pht('Author');
+ }
+
+ public function getFieldDescription() {
+ return pht('Stores the revision author.');
+ }
+
+ public function shouldAppearInPropertyView() {
+ return true;
+ }
+
+ public function renderPropertyViewLabel() {
+ return $this->getFieldName();
+ }
+
+ public function getRequiredHandlePHIDsForPropertyView() {
+ return array($this->getObject()->getAuthorPHID());
+ }
+
+ public function renderPropertyViewValue(array $handles) {
+ return $handles[$this->getObject()->getAuthorPHID()]->renderLink();
+ }
+
+}
Index: src/applications/differential/customfield/DifferentialCommitsField.php
===================================================================
--- /dev/null
+++ src/applications/differential/customfield/DifferentialCommitsField.php
@@ -0,0 +1,34 @@
+<?php
+
+final class DifferentialCommitsField
+ extends DifferentialCustomField {
+
+ public function getFieldKey() {
+ return 'differential:commits';
+ }
+
+ public function getFieldName() {
+ return pht('Commits');
+ }
+
+ public function getFieldDescription() {
+ return pht('Shows associated commits.');
+ }
+
+ public function shouldAppearInPropertyView() {
+ return true;
+ }
+
+ public function renderPropertyViewLabel() {
+ return $this->getFieldName();
+ }
+
+ public function getRequiredHandlePHIDsForPropertyView() {
+ return $this->getObject()->getCommitPHIDs();
+ }
+
+ public function renderPropertyViewValue(array $handles) {
+ return $this->renderHandleList($handles);
+ }
+
+}
Index: src/applications/differential/customfield/DifferentialCustomField.php
===================================================================
--- src/applications/differential/customfield/DifferentialCustomField.php
+++ src/applications/differential/customfield/DifferentialCustomField.php
@@ -3,4 +3,17 @@
abstract class DifferentialCustomField
extends PhabricatorCustomField {
+ protected function renderHandleList(array $handles) {
+ if (!$handles) {
+ return null;
+ }
+
+ $out = array();
+ foreach ($handles as $handle) {
+ $out[] = $handle->renderLink();
+ }
+
+ return phutil_implode_html(phutil_tag('br'), $out);
+ }
+
}
Index: src/applications/differential/customfield/DifferentialDependenciesField.php
===================================================================
--- /dev/null
+++ src/applications/differential/customfield/DifferentialDependenciesField.php
@@ -0,0 +1,36 @@
+<?php
+
+final class DifferentialDependenciesField
+ extends DifferentialCustomField {
+
+ public function getFieldKey() {
+ return 'differential:dependencies';
+ }
+
+ public function getFieldName() {
+ return pht('Dependencies');
+ }
+
+ public function getFieldDescription() {
+ return pht('Lists revisions this one is depended on by.');
+ }
+
+ public function shouldAppearInPropertyView() {
+ return true;
+ }
+
+ public function renderPropertyViewLabel() {
+ return $this->getFieldName();
+ }
+
+ public function getRequiredHandlePHIDsForPropertyView() {
+ return PhabricatorEdgeQuery::loadDestinationPHIDs(
+ $this->getObject()->getPHID(),
+ PhabricatorEdgeConfig::TYPE_DREV_DEPENDED_ON_BY_DREV);
+ }
+
+ public function renderPropertyViewValue(array $handles) {
+ return $this->renderHandleList($handles);
+ }
+
+}
Index: src/applications/differential/customfield/DifferentialDependsOnField.php
===================================================================
--- /dev/null
+++ src/applications/differential/customfield/DifferentialDependsOnField.php
@@ -0,0 +1,36 @@
+<?php
+
+final class DifferentialDependsOnField
+ extends DifferentialCustomField {
+
+ public function getFieldKey() {
+ return 'differential:depends-on';
+ }
+
+ public function getFieldName() {
+ return pht('Depends On');
+ }
+
+ public function getFieldDescription() {
+ return pht('Lists revisions this one depends on.');
+ }
+
+ public function shouldAppearInPropertyView() {
+ return true;
+ }
+
+ public function renderPropertyViewLabel() {
+ return $this->getFieldName();
+ }
+
+ public function getRequiredHandlePHIDsForPropertyView() {
+ return PhabricatorEdgeQuery::loadDestinationPHIDs(
+ $this->getObject()->getPHID(),
+ PhabricatorEdgeConfig::TYPE_DREV_DEPENDS_ON_DREV);
+ }
+
+ public function renderPropertyViewValue(array $handles) {
+ return $this->renderHandleList($handles);
+ }
+
+}
Index: src/applications/differential/customfield/DifferentialJIRAIssuesField.php
===================================================================
--- /dev/null
+++ src/applications/differential/customfield/DifferentialJIRAIssuesField.php
@@ -0,0 +1,76 @@
+<?php
+
+final class DifferentialJIRAIssuesField
+ extends DifferentialCustomField {
+
+ // TODO: This field needs to actually read storage!
+ private $value = null;
+
+
+ public function getFieldKey() {
+ return 'differential:jira-issues';
+ }
+
+ public function getFieldName() {
+ return pht('JIRA Issues');
+ }
+
+ public function getFieldDescription() {
+ return pht('Lists associated JIRA issues.');
+ }
+
+ public function shouldAppearInPropertyView() {
+ return true;
+ }
+
+ public function renderPropertyViewLabel() {
+ return $this->getFieldName();
+ }
+
+ public function renderPropertyViewValue(array $handles) {
+ $xobjs = $this->loadDoorkeeperExternalObjects();
+ if (!$xobjs) {
+ return null;
+ }
+
+ $links = array();
+ foreach ($xobjs as $xobj) {
+ $links[] = id(new DoorkeeperTagView())
+ ->setExternalObject($xobj);
+ }
+
+ return phutil_implode_html(phutil_tag('br'), $links);
+ }
+
+ private function buildDoorkeeperRefs() {
+ $provider = PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider();
+
+ $refs = array();
+ if ($this->value) {
+ foreach ($this->value as $jira_key) {
+ $refs[] = id(new DoorkeeperObjectRef())
+ ->setApplicationType(DoorkeeperBridgeJIRA::APPTYPE_JIRA)
+ ->setApplicationDomain($provider->getProviderDomain())
+ ->setObjectType(DoorkeeperBridgeJIRA::OBJTYPE_ISSUE)
+ ->setObjectID($jira_key);
+ }
+ }
+
+ return $refs;
+ }
+
+ private function loadDoorkeeperExternalObjects() {
+ $refs = $this->buildDoorkeeperRefs();
+ if (!$refs) {
+ return array();
+ }
+
+ $xobjs = id(new DoorkeeperExternalObjectQuery())
+ ->setViewer($this->getUser())
+ ->withObjectKeys(mpull($refs, 'getObjectKey'))
+ ->execute();
+
+ return $xobjs;
+ }
+
+}
Index: src/applications/differential/customfield/DifferentialManiphestTasksField.php
===================================================================
--- /dev/null
+++ src/applications/differential/customfield/DifferentialManiphestTasksField.php
@@ -0,0 +1,36 @@
+<?php
+
+final class DifferentialManiphestTasksField
+ extends DifferentialCustomField {
+
+ public function getFieldKey() {
+ return 'differential:maniphest-tasks';
+ }
+
+ public function getFieldName() {
+ return pht('Maniphest Tasks');
+ }
+
+ public function getFieldDescription() {
+ return pht('Lists associated tasks.');
+ }
+
+ public function shouldAppearInPropertyView() {
+ return true;
+ }
+
+ public function renderPropertyViewLabel() {
+ return $this->getFieldName();
+ }
+
+ public function getRequiredHandlePHIDsForPropertyView() {
+ return PhabricatorEdgeQuery::loadDestinationPHIDs(
+ $this->getObject()->getPHID(),
+ PhabricatorEdgeConfig::TYPE_DREV_HAS_RELATED_TASK);
+ }
+
+ public function renderPropertyViewValue(array $handles) {
+ return $this->renderHandleList($handles);
+ }
+
+}
Index: src/applications/differential/customfield/DifferentialProjectReviewersField.php
===================================================================
--- /dev/null
+++ src/applications/differential/customfield/DifferentialProjectReviewersField.php
@@ -0,0 +1,55 @@
+<?php
+
+final class DifferentialProjectReviewersField
+ extends DifferentialCustomField {
+
+ public function getFieldKey() {
+ return 'differential:project-reviewers';
+ }
+
+ public function getFieldName() {
+ return pht('Project Reviewers');
+ }
+
+ public function getFieldDescription() {
+ return pht('Display project reviewers.');
+ }
+
+ public function shouldAppearInPropertyView() {
+ return true;
+ }
+
+ public function renderPropertyViewLabel() {
+ return $this->getFieldName();
+ }
+
+ public function getRequiredHandlePHIDsForPropertyView() {
+ return mpull($this->getProjectReviewers(), 'getReviewerPHID');
+ }
+
+ public function renderPropertyViewValue(array $handles) {
+ $reviewers = $this->getProjectReviewers();
+ if (!$reviewers) {
+ return null;
+ }
+
+ $view = id(new DifferentialReviewersView())
+ ->setUser($this->getViewer())
+ ->setReviewers($reviewers)
+ ->setHandles($handles);
+
+ // TODO: Active diff stuff.
+
+ return $view;
+ }
+
+ private function getProjectReviewers() {
+ $reviewers = array();
+ foreach ($this->getObject()->getReviewerStatus() as $reviewer) {
+ if (!$reviewer->isUser()) {
+ $reviewers[] = $reviewer;
+ }
+ }
+ return $reviewers;
+ }
+}
Index: src/applications/differential/customfield/DifferentialRepositoryField.php
===================================================================
--- src/applications/differential/customfield/DifferentialRepositoryField.php
+++ src/applications/differential/customfield/DifferentialRepositoryField.php
@@ -123,4 +123,24 @@
}
}
+ public function shouldAppearInPropertyView() {
+ return true;
+ }
+
+ public function renderPropertyViewLabel() {
+ return $this->getFieldName();
+ }
+
+ public function getRequiredHandlePHIDsForPropertyView() {
+ $repository_phid = $this->getObject()->getRepositoryPHID();
+ if ($repository_phid) {
+ return array($repository_phid);
+ }
+ return array();
+ }
+
+ public function renderPropertyViewValue(array $handles) {
+ return $this->renderHandleList($handles);
+ }
+
}
Index: src/applications/differential/customfield/DifferentialReviewersField.php
===================================================================
--- src/applications/differential/customfield/DifferentialReviewersField.php
+++ src/applications/differential/customfield/DifferentialReviewersField.php
@@ -81,4 +81,41 @@
);
}
+ public function shouldAppearInPropertyView() {
+ return true;
+ }
+
+ public function renderPropertyViewLabel() {
+ return $this->getFieldName();
+ }
+
+ public function getRequiredHandlePHIDsForPropertyView() {
+ return mpull($this->getUserReviewers(), 'getReviewerPHID');
+ }
+
+ public function renderPropertyViewValue(array $handles) {
+ $reviewers = $this->getUserReviewers();
+ if (!$reviewers) {
+ return phutil_tag('em', array(), pht('None'));
+ }
+
+ $view = id(new DifferentialReviewersView())
+ ->setUser($this->getViewer())
+ ->setReviewers($reviewers)
+ ->setHandles($handles);
+
+ // TODO: Active diff stuff.
+
+ return $view;
+ }
+
+ private function getUserReviewers() {
+ $reviewers = array();
+ foreach ($this->getObject()->getReviewerStatus() as $reviewer) {
+ if ($reviewer->isUser()) {
+ $reviewers[] = $reviewer;
+ }
+ }
+ return $reviewers;
+ }
}
Index: src/applications/people/customfield/PhabricatorUserBlurbField.php
===================================================================
--- src/applications/people/customfield/PhabricatorUserBlurbField.php
+++ src/applications/people/customfield/PhabricatorUserBlurbField.php
@@ -61,7 +61,7 @@
return null;
}
- public function renderPropertyViewValue() {
+ public function renderPropertyViewValue(array $handles) {
$blurb = $this->getObject()->loadUserProfile()->getBlurb();
if (!strlen($blurb)) {
return null;
Index: src/applications/people/customfield/PhabricatorUserRolesField.php
===================================================================
--- src/applications/people/customfield/PhabricatorUserRolesField.php
+++ src/applications/people/customfield/PhabricatorUserRolesField.php
@@ -21,7 +21,7 @@
return true;
}
- public function renderPropertyViewValue() {
+ public function renderPropertyViewValue(array $handles) {
$user = $this->getObject();
$roles = array();
Index: src/applications/people/customfield/PhabricatorUserSinceField.php
===================================================================
--- src/applications/people/customfield/PhabricatorUserSinceField.php
+++ src/applications/people/customfield/PhabricatorUserSinceField.php
@@ -21,7 +21,7 @@
return true;
}
- public function renderPropertyViewValue() {
+ public function renderPropertyViewValue(array $handles) {
$absolute = phabricator_datetime(
$this->getObject()->getDateCreated(),
$this->getViewer());
Index: src/applications/people/customfield/PhabricatorUserStatusField.php
===================================================================
--- src/applications/people/customfield/PhabricatorUserStatusField.php
+++ src/applications/people/customfield/PhabricatorUserStatusField.php
@@ -21,7 +21,7 @@
return true;
}
- public function renderPropertyViewValue() {
+ public function renderPropertyViewValue(array $handles) {
$user = $this->getObject();
$viewer = $this->requireViewer();
Index: src/infrastructure/customfield/field/PhabricatorCustomField.php
===================================================================
--- src/infrastructure/customfield/field/PhabricatorCustomField.php
+++ src/infrastructure/customfield/field/PhabricatorCustomField.php
@@ -1051,9 +1051,9 @@
/**
* @task view
*/
- public function renderPropertyViewValue() {
+ public function renderPropertyViewValue(array $handles) {
if ($this->proxy) {
- return $this->proxy->renderPropertyViewValue();
+ return $this->proxy->renderPropertyViewValue($handles);
}
throw new PhabricatorCustomFieldImplementationIncompleteException($this);
}
@@ -1070,6 +1070,17 @@
}
+ /**
+ * @task view
+ */
+ public function getRequiredHandlePHIDsForPropertyView() {
+ if ($this->proxy) {
+ return $this->proxy->getRequiredHandlePHIDsForPropertyView();
+ }
+ return array();
+ }
+
+
/* -( List View )---------------------------------------------------------- */
Index: src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
===================================================================
--- src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
+++ src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
@@ -149,9 +149,25 @@
$add_header = null;
- foreach ($fields as $field) {
+ $phids = array();
+ foreach ($fields as $key => $field) {
+ $phids[$key] = $field->getRequiredHandlePHIDsForPropertyView();
+ }
+
+ $all_phids = array_mergev($phids);
+ if ($all_phids) {
+ $handles = id(new PhabricatorHandleQuery())
+ ->setViewer($viewer)
+ ->withPHIDs($all_phids)
+ ->execute();
+ } else {
+ $handles = array();
+ }
+
+ foreach ($fields as $key => $field) {
+ $field_handles = array_select_keys($handles, $phids[$key]);
$label = $field->renderPropertyViewLabel();
- $value = $field->renderPropertyViewValue();
+ $value = $field->renderPropertyViewValue($field_handles);
if ($value !== null) {
switch ($field->getStyleForPropertyView()) {
case 'header':
Index: src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php
===================================================================
--- src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php
+++ src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php
@@ -217,7 +217,7 @@
return $this->getFieldConfigValue('view', true);
}
- public function renderPropertyViewValue() {
+ public function renderPropertyViewValue(array $handles) {
if (!strlen($this->getFieldValue())) {
return null;
}
Index: src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldBool.php
===================================================================
--- src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldBool.php
+++ src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldBool.php
@@ -83,7 +83,7 @@
(bool)$this->getFieldValue());
}
- public function renderPropertyViewValue() {
+ public function renderPropertyViewValue(array $handles) {
$value = $this->getFieldValue();
if ($value) {
return $this->getString('view.yes', pht('Yes'));
Index: src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php
===================================================================
--- src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php
+++ src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php
@@ -48,7 +48,7 @@
$this->setFieldValue($value);
}
- public function renderPropertyViewValue() {
+ public function renderPropertyViewValue(array $handles) {
$value = $this->getFieldValue();
if (!$value) {
return null;
Index: src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldHeader.php
===================================================================
--- src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldHeader.php
+++ src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldHeader.php
@@ -26,7 +26,7 @@
return 'header';
}
- public function renderPropertyViewValue() {
+ public function renderPropertyViewValue(array $handles) {
return $this->getFieldName();
}
Index: src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php
===================================================================
--- src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php
+++ src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php
@@ -68,19 +68,20 @@
return array();
}
- public function renderPropertyViewValue() {
+ public function getRequiredHandlePHIDsForProperyView() {
+ $value = $this->getFieldValue();
+ if ($value) {
+ return $value;
+ }
+ return array();
+ }
+
+ public function renderPropertyViewValue(array $handles) {
$value = $this->getFieldValue();
if (!$value) {
return null;
}
- // TODO: Surface and batch this.
-
- $handles = id(new PhabricatorHandleQuery())
- ->setViewer($this->getViewer())
- ->withPHIDs($value)
- ->execute();
-
$handles = mpull($handles, 'renderLink');
$handles = phutil_implode_html(', ', $handles);
return $handles;
Index: src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php
===================================================================
--- src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php
+++ src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php
@@ -19,7 +19,7 @@
return 'block';
}
- public function renderPropertyViewValue() {
+ public function renderPropertyViewValue(array $handles) {
$value = $this->getFieldValue();
if (!strlen($value)) {
Index: src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php
===================================================================
--- src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php
+++ src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php
@@ -73,7 +73,7 @@
->setOptions($this->getOptions());
}
- public function renderPropertyViewValue() {
+ public function renderPropertyViewValue(array $handles) {
if (!strlen($this->getFieldValue())) {
return null;
}

File Metadata

Mime Type
text/plain
Expires
Mar 18 2025, 2:01 PM (5 w, 1 d ago)
Storage Engine
amazon-s3
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
phabricator/secure/5z/q4/dpkurndeccnkpixx
Default Alt Text
D8354.id.diff (34 KB)

Event Timeline