Index: src/__phutil_library_map__.php =================================================================== --- src/__phutil_library_map__.php +++ src/__phutil_library_map__.php @@ -331,6 +331,7 @@ 'DifferentialAuthorField' => 'applications/differential/customfield/DifferentialAuthorField.php', 'DifferentialAuthorFieldSpecification' => 'applications/differential/field/specification/DifferentialAuthorFieldSpecification.php', 'DifferentialAuxiliaryField' => 'applications/differential/storage/DifferentialAuxiliaryField.php', + 'DifferentialBlameRevisionField' => 'applications/differential/customfield/DifferentialBlameRevisionField.php', 'DifferentialBlameRevisionFieldSpecification' => 'applications/differential/field/specification/DifferentialBlameRevisionFieldSpecification.php', 'DifferentialBranchFieldSpecification' => 'applications/differential/field/specification/DifferentialBranchFieldSpecification.php', 'DifferentialCCWelcomeMail' => 'applications/differential/mail/DifferentialCCWelcomeMail.php', @@ -404,6 +405,7 @@ 'DifferentialFreeformFieldSpecification' => 'applications/differential/field/specification/DifferentialFreeformFieldSpecification.php', 'DifferentialGetWorkingCopy' => 'applications/differential/DifferentialGetWorkingCopy.php', 'DifferentialGitSVNIDFieldSpecification' => 'applications/differential/field/specification/DifferentialGitSVNIDFieldSpecification.php', + 'DifferentialHostField' => 'applications/differential/customfield/DifferentialHostField.php', 'DifferentialHostFieldSpecification' => 'applications/differential/field/specification/DifferentialHostFieldSpecification.php', 'DifferentialHovercardEventListener' => 'applications/differential/event/DifferentialHovercardEventListener.php', 'DifferentialHunk' => 'applications/differential/storage/DifferentialHunk.php', @@ -436,6 +438,7 @@ 'DifferentialPHIDTypeRevision' => 'applications/differential/phid/DifferentialPHIDTypeRevision.php', 'DifferentialParseCacheGarbageCollector' => 'applications/differential/garbagecollector/DifferentialParseCacheGarbageCollector.php', 'DifferentialParseRenderTestCase' => 'applications/differential/__tests__/DifferentialParseRenderTestCase.php', + 'DifferentialPathField' => 'applications/differential/customfield/DifferentialPathField.php', 'DifferentialPathFieldSpecification' => 'applications/differential/field/specification/DifferentialPathFieldSpecification.php', 'DifferentialPrimaryPaneView' => 'applications/differential/view/DifferentialPrimaryPaneView.php', 'DifferentialProjectReviewersField' => 'applications/differential/customfield/DifferentialProjectReviewersField.php', @@ -448,6 +451,7 @@ 'DifferentialRepositoryFieldSpecification' => 'applications/differential/field/specification/DifferentialRepositoryFieldSpecification.php', 'DifferentialRepositoryLookup' => 'applications/differential/query/DifferentialRepositoryLookup.php', 'DifferentialResultsTableView' => 'applications/differential/view/DifferentialResultsTableView.php', + 'DifferentialRevertPlanField' => 'applications/differential/customfield/DifferentialRevertPlanField.php', 'DifferentialRevertPlanFieldSpecification' => 'applications/differential/field/specification/DifferentialRevertPlanFieldSpecification.php', 'DifferentialReviewRequestMail' => 'applications/differential/mail/DifferentialReviewRequestMail.php', 'DifferentialReviewedByFieldSpecification' => 'applications/differential/field/specification/DifferentialReviewedByFieldSpecification.php', @@ -475,6 +479,7 @@ 'DifferentialRevisionUpdateHistoryView' => 'applications/differential/view/DifferentialRevisionUpdateHistoryView.php', 'DifferentialRevisionViewController' => 'applications/differential/controller/DifferentialRevisionViewController.php', 'DifferentialSearchIndexer' => 'applications/differential/search/DifferentialSearchIndexer.php', + 'DifferentialStoredCustomField' => 'applications/differential/customfield/DifferentialStoredCustomField.php', 'DifferentialSubscribersField' => 'applications/differential/customfield/DifferentialSubscribersField.php', 'DifferentialSummaryField' => 'applications/differential/customfield/DifferentialSummaryField.php', 'DifferentialSummaryFieldSpecification' => 'applications/differential/field/specification/DifferentialSummaryFieldSpecification.php', @@ -2891,6 +2896,7 @@ 'DifferentialAuditorsFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialAuthorField' => 'DifferentialCustomField', 'DifferentialAuthorFieldSpecification' => 'DifferentialFieldSpecification', + 'DifferentialBlameRevisionField' => 'DifferentialStoredCustomField', 'DifferentialBlameRevisionFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialBranchFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialCCWelcomeMail' => 'DifferentialReviewRequestMail', @@ -2962,6 +2968,7 @@ 'DifferentialFieldValidationException' => 'Exception', 'DifferentialFreeformFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialGitSVNIDFieldSpecification' => 'DifferentialFieldSpecification', + 'DifferentialHostField' => 'DifferentialCustomField', 'DifferentialHostFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialHovercardEventListener' => 'PhabricatorEventListener', 'DifferentialHunk' => 'DifferentialDAO', @@ -2973,7 +2980,7 @@ 'DifferentialInlineCommentPreviewController' => 'PhabricatorInlineCommentPreviewController', 'DifferentialInlineCommentQuery' => 'PhabricatorOffsetPagedQuery', 'DifferentialInlineCommentView' => 'AphrontView', - 'DifferentialJIRAIssuesField' => 'DifferentialCustomField', + 'DifferentialJIRAIssuesField' => 'DifferentialStoredCustomField', 'DifferentialJIRAIssuesFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialLandingActionMenuEventListener' => 'PhabricatorEventListener', 'DifferentialLandingToGitHub' => 'DifferentialLandingStrategy', @@ -2990,6 +2997,7 @@ 'DifferentialPHIDTypeRevision' => 'PhabricatorPHIDType', 'DifferentialParseCacheGarbageCollector' => 'PhabricatorGarbageCollector', 'DifferentialParseRenderTestCase' => 'PhabricatorTestCase', + 'DifferentialPathField' => 'DifferentialCustomField', 'DifferentialPathFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialPrimaryPaneView' => 'AphrontView', 'DifferentialProjectReviewersField' => 'DifferentialCustomField', @@ -3001,6 +3009,7 @@ 'DifferentialRepositoryFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialRepositoryLookup' => 'Phobject', 'DifferentialResultsTableView' => 'AphrontView', + 'DifferentialRevertPlanField' => 'DifferentialStoredCustomField', 'DifferentialRevertPlanFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialReviewRequestMail' => 'DifferentialMail', 'DifferentialReviewedByFieldSpecification' => 'DifferentialFieldSpecification', @@ -3038,6 +3047,7 @@ 'DifferentialRevisionUpdateHistoryView' => 'AphrontView', 'DifferentialRevisionViewController' => 'DifferentialController', 'DifferentialSearchIndexer' => 'PhabricatorSearchDocumentIndexer', + 'DifferentialStoredCustomField' => 'DifferentialCustomField', 'DifferentialSubscribersField' => 'DifferentialCoreCustomField', 'DifferentialSummaryField' => 'DifferentialCoreCustomField', 'DifferentialSummaryFieldSpecification' => 'DifferentialFreeformFieldSpecification', Index: src/applications/differential/customfield/DifferentialBlameRevisionField.php =================================================================== --- /dev/null +++ src/applications/differential/customfield/DifferentialBlameRevisionField.php @@ -0,0 +1,83 @@ +getFieldName(); + } + + public function renderPropertyViewValue(array $handles) { + return $this->getValue(); + } + + public function shouldAppearInEditView() { + return true; + } + + public function shouldAppearInApplicationTransactions() { + return true; + } + + public function getOldValueForApplicationTransactions() { + return $this->getValue(); + } + + public function getNewValueForApplicationTransactions() { + return $this->getValue(); + } + + public function readValueFromRequest(AphrontRequest $request) { + $this->setValue($request->getStr($this->getFieldKey())); + } + + public function renderEditControl(array $handles) { + return id(new AphrontFormTextControl()) + ->setName($this->getFieldKey()) + ->setValue($this->getValue()) + ->setLabel($this->getFieldName()); + } + + public function getApplicationTransactionTitle( + PhabricatorApplicationTransaction $xaction) { + $author_phid = $xaction->getAuthorPHID(); + $old = $xaction->getOldValue(); + $new = $xaction->getNewValue(); + + return pht( + '%s updated the blame revision for this revision.', + $xaction->renderHandleLink($author_phid)); + } + + public function getApplicationTransactionTitleForFeed( + PhabricatorApplicationTransaction $xaction, + PhabricatorFeedStory $story) { + + $object_phid = $xaction->getObjectPHID(); + $author_phid = $xaction->getAuthorPHID(); + $old = $xaction->getOldValue(); + $new = $xaction->getNewValue(); + + return pht( + '%s updated the blame revision for %s.', + $xaction->renderHandleLink($author_phid), + $xaction->renderHandleLink($object_phid)); + } + +} Index: src/applications/differential/customfield/DifferentialHostField.php =================================================================== --- /dev/null +++ src/applications/differential/customfield/DifferentialHostField.php @@ -0,0 +1,35 @@ +getFieldName(); + } + + public function renderPropertyViewValue(array $handles) { + $host = $this->getObject()->getActiveDiff()->getSourceMachine(); + if (!$host) { + return null; + } + + return $host; + } + +} Index: src/applications/differential/customfield/DifferentialJIRAIssuesField.php =================================================================== --- src/applications/differential/customfield/DifferentialJIRAIssuesField.php +++ src/applications/differential/customfield/DifferentialJIRAIssuesField.php @@ -1,14 +1,19 @@ getValue()); + } - public function getFieldKey() { - return 'differential:jira-issues'; + public function setValueFromStorage($value) { + $this->setValue(json_decode($value, true)); + return $this; } public function getFieldName() { @@ -46,8 +51,8 @@ $provider = PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); $refs = array(); - if ($this->value) { - foreach ($this->value as $jira_key) { + if ($this->getValue()) { + foreach ($this->getValue() as $jira_key) { $refs[] = id(new DoorkeeperObjectRef()) ->setApplicationType(DoorkeeperBridgeJIRA::APPTYPE_JIRA) ->setApplicationDomain($provider->getProviderDomain()) @@ -66,11 +71,13 @@ } $xobjs = id(new DoorkeeperExternalObjectQuery()) - ->setViewer($this->getUser()) + ->setViewer($this->getViewer()) ->withObjectKeys(mpull($refs, 'getObjectKey')) ->execute(); return $xobjs; } + // TODO: Implement edit; this field is readonly for now. + } Index: src/applications/differential/customfield/DifferentialPathField.php =================================================================== --- /dev/null +++ src/applications/differential/customfield/DifferentialPathField.php @@ -0,0 +1,35 @@ +getFieldName(); + } + + public function renderPropertyViewValue(array $handles) { + $path = $this->getObject()->getActiveDiff()->getSourcePath(); + if (!$path) { + return null; + } + + return $path; + } + +} Index: src/applications/differential/customfield/DifferentialRevertPlanField.php =================================================================== --- src/applications/differential/customfield/DifferentialRevertPlanField.php +++ src/applications/differential/customfield/DifferentialRevertPlanField.php @@ -1,43 +1,74 @@ getTestPlan(); + public function shouldAppearInPropertyView() { + return true; + } + + public function renderPropertyViewLabel() { + return $this->getFieldName(); } - protected function writeValueToRevision( - DifferentialRevision $revision, - $value) { - $revision->setTestPlan($value); + public function getStyleForPropertyView() { + return 'block'; } - protected function isCoreFieldRequired() { - return PhabricatorEnv::getEnvConfig('differential.require-test-plan-field'); + public function getIconForPropertyView() { + return PHUIPropertyListView::ICON_TESTPLAN; } - public function canDisableField() { + public function renderPropertyViewValue(array $handles) { + if (!strlen($this->getValue())) { + return null; + } + + return PhabricatorMarkupEngine::renderOneObject( + id(new PhabricatorMarkupOneOff()) + ->setPreserveLinebreaks(true) + ->setContent($this->getValue()), + 'default', + $this->getViewer()); + } + + public function shouldAppearInGlobalSearch() { return true; } - protected function getCoreFieldRequiredErrorString() { - return pht( - 'You must provide a test plan: describe the actions you performed '. - 'to verify the behvaior of this change.'); + public function updateAbstractDocument( + PhabricatorSearchAbstractDocument $document) { + if (strlen($this->getValue())) { + $document->addField('rvrt', $this->getValue()); + } + } + + public function shouldAppearInEditView() { + return true; + } + + public function shouldAppearInApplicationTransactions() { + return true; + } + + public function getOldValueForApplicationTransactions() { + return $this->getValue(); + } + + public function getNewValueForApplicationTransactions() { + return $this->getValue(); } public function readValueFromRequest(AphrontRequest $request) { @@ -48,7 +79,6 @@ return id(new PhabricatorRemarkupControl()) ->setName($this->getFieldKey()) ->setValue($this->getValue()) - ->setError($this->getFieldError()) ->setLabel($this->getFieldName()); } @@ -59,7 +89,7 @@ $new = $xaction->getNewValue(); return pht( - '%s updated the test plan for this revision.', + '%s updated the revert plan for this revision.', $xaction->renderHandleLink($author_phid)); } @@ -73,7 +103,7 @@ $new = $xaction->getNewValue(); return pht( - '%s updated the test plan for %s.', + '%s updated the revert plan for %s.', $xaction->renderHandleLink($author_phid), $xaction->renderHandleLink($object_phid)); } @@ -92,16 +122,4 @@ $xaction->getNewValue()); } - - public function shouldAppearInGlobalSearch() { - return true; - } - - public function updateAbstractDocument( - PhabricatorSearchAbstractDocument $document) { - if (strlen($this->getValue())) { - $document->addField('plan', $this->getValue()); - } - } - } Index: src/applications/differential/customfield/DifferentialStoredCustomField.php =================================================================== --- /dev/null +++ src/applications/differential/customfield/DifferentialStoredCustomField.php @@ -0,0 +1,42 @@ +value = $value; + return $this; + } + + public function getValue() { + return $this->value; + } + + public function shouldUseStorage() { + return true; + } + + public function newStorageObject() { + return new DifferentialCustomFieldStorage(); + } + + protected function newStringIndexStorage() { + return new DifferentialCustomFieldStringIndex(); + } + + protected function newNumericIndexStorage() { + return new DifferentialCustomFieldNumericIndex(); + } + + public function getValueForStorage() { + return $this->value; + } + + public function setValueFromStorage($value) { + $this->value = $value; + return $this; + } + +} Index: src/applications/differential/customfield/DifferentialSummaryField.php =================================================================== --- src/applications/differential/customfield/DifferentialSummaryField.php +++ src/applications/differential/customfield/DifferentialSummaryField.php @@ -89,4 +89,33 @@ } } + public function shouldAppearInPropertyView() { + return true; + } + + public function renderPropertyViewLabel() { + return $this->getFieldName(); + } + + public function getStyleForPropertyView() { + return 'block'; + } + + public function getIconForPropertyView() { + return PHUIPropertyListView::ICON_SUMMARY; + } + + public function renderPropertyViewValue(array $handles) { + if (!strlen($this->getValue())) { + return null; + } + + return PhabricatorMarkupEngine::renderOneObject( + id(new PhabricatorMarkupOneOff()) + ->setPreserveLinebreaks(true) + ->setContent($this->getValue()), + 'default', + $this->getViewer()); + } + } Index: src/applications/differential/customfield/DifferentialTestPlanField.php =================================================================== --- src/applications/differential/customfield/DifferentialTestPlanField.php +++ src/applications/differential/customfield/DifferentialTestPlanField.php @@ -104,4 +104,33 @@ } } + public function shouldAppearInPropertyView() { + return true; + } + + public function renderPropertyViewLabel() { + return $this->getFieldName(); + } + + public function getStyleForPropertyView() { + return 'block'; + } + + public function getIconForPropertyView() { + return PHUIPropertyListView::ICON_TESTPLAN; + } + + public function renderPropertyViewValue(array $handles) { + if (!strlen($this->getValue())) { + return null; + } + + return PhabricatorMarkupEngine::renderOneObject( + id(new PhabricatorMarkupOneOff()) + ->setPreserveLinebreaks(true) + ->setContent($this->getValue()), + 'default', + $this->getViewer()); + } + } Index: src/applications/differential/storage/DifferentialRevision.php =================================================================== --- src/applications/differential/storage/DifferentialRevision.php +++ src/applications/differential/storage/DifferentialRevision.php @@ -73,6 +73,11 @@ ) + parent::getConfiguration(); } + public function getMonogram() { + $id = $this->getID(); + return "D{$id}"; + } + public function setTitle($title) { $this->title = $title; if (!$this->getID()) { Index: src/infrastructure/customfield/field/PhabricatorCustomField.php =================================================================== --- src/infrastructure/customfield/field/PhabricatorCustomField.php +++ src/infrastructure/customfield/field/PhabricatorCustomField.php @@ -278,6 +278,10 @@ return true; } + public function shouldDisableByDefault() { + return false; + } + /** * Return an index string which uniquely identifies this field. @@ -1073,6 +1077,17 @@ /** * @task view */ + public function getIconForPropertyView() { + if ($this->proxy) { + return $this->proxy->getIconForPropertyView(); + } + return null; + } + + + /** + * @task view + */ public function getRequiredHandlePHIDsForPropertyView() { if ($this->proxy) { return $this->proxy->getRequiredHandlePHIDsForPropertyView(); Index: src/infrastructure/customfield/field/PhabricatorCustomFieldList.php =================================================================== --- src/infrastructure/customfield/field/PhabricatorCustomFieldList.php +++ src/infrastructure/customfield/field/PhabricatorCustomFieldList.php @@ -199,9 +199,10 @@ $view->addProperty($label, $value); break; case 'block': + $icon = $field->getIconForPropertyView(); $view->invokeWillRenderEvent(); if ($label !== null) { - $view->addSectionHeader($label); + $view->addSectionHeader($label, $icon); } $view->addTextContent($value); break;