From f1f24e036034c8edba858d6b2150aef3aa7129dd Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Dec 2016 09:50:54 -0800 Subject: [PATCH] Simplify "Repository" field in Differential Summary: Ref T11114. Keep mail and UI, toss the rest. Test Plan: Edited/viewed repositories. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17087 --- .../DifferentialRepositoryField.php | 101 ------------------ .../storage/DifferentialTransaction.php | 2 + 2 files changed, 2 insertions(+), 101 deletions(-) diff --git a/src/applications/differential/customfield/DifferentialRepositoryField.php b/src/applications/differential/customfield/DifferentialRepositoryField.php index 7f39d25823..1d403d160a 100644 --- a/src/applications/differential/customfield/DifferentialRepositoryField.php +++ b/src/applications/differential/customfield/DifferentialRepositoryField.php @@ -20,107 +20,6 @@ final class DifferentialRepositoryField return $revision->getRepositoryPHID(); } - protected function writeValueToRevision( - DifferentialRevision $revision, - $value) { - $revision->setRepositoryPHID($value); - } - - public function readValueFromRequest(AphrontRequest $request) { - $phids = $request->getArr($this->getFieldKey()); - $first = head($phids); - $this->setValue(nonempty($first, null)); - } - - public function renderEditControl(array $handles) { - if ($this->getValue()) { - $value = array($this->getValue()); - } else { - $value = array(); - } - - return id(new AphrontFormTokenizerControl()) - ->setUser($this->getViewer()) - ->setName($this->getFieldKey()) - ->setDatasource(new DiffusionRepositoryDatasource()) - ->setValue($value) - ->setError($this->getFieldError()) - ->setLabel($this->getFieldName()) - ->setLimit(1); - } - - public function getApplicationTransactionRequiredHandlePHIDs( - PhabricatorApplicationTransaction $xaction) { - - $old = $xaction->getOldValue(); - $new = $xaction->getNewValue(); - - $phids = array(); - if ($old) { - $phids[] = $old; - } - if ($new) { - $phids[] = $new; - } - - return $phids; - } - - public function getApplicationTransactionTitle( - PhabricatorApplicationTransaction $xaction) { - $author_phid = $xaction->getAuthorPHID(); - $old = $xaction->getOldValue(); - $new = $xaction->getNewValue(); - - if ($old && $new) { - return pht( - '%s changed the repository for this revision from %s to %s.', - $xaction->renderHandleLink($author_phid), - $xaction->renderHandleLink($old), - $xaction->renderHandleLink($new)); - } else if ($new) { - return pht( - '%s set the repository for this revision to %s.', - $xaction->renderHandleLink($author_phid), - $xaction->renderHandleLink($new)); - } else { - return pht( - '%s removed %s as the repository for this revision.', - $xaction->renderHandleLink($author_phid), - $xaction->renderHandleLink($old)); - } - } - - public function getApplicationTransactionTitleForFeed( - PhabricatorApplicationTransaction $xaction) { - - $object_phid = $xaction->getObjectPHID(); - $author_phid = $xaction->getAuthorPHID(); - $old = $xaction->getOldValue(); - $new = $xaction->getNewValue(); - - if ($old && $new) { - return pht( - '%s updated the repository for %s from %s to %s.', - $xaction->renderHandleLink($author_phid), - $xaction->renderHandleLink($object_phid), - $xaction->renderHandleLink($old), - $xaction->renderHandleLink($new)); - } else if ($new) { - return pht( - '%s set the repository for %s to %s.', - $xaction->renderHandleLink($author_phid), - $xaction->renderHandleLink($object_phid), - $xaction->renderHandleLink($new)); - } else { - return pht( - '%s removed the repository for %s. (Repository was %s.)', - $xaction->renderHandleLink($author_phid), - $xaction->renderHandleLink($object_phid), - $xaction->renderHandleLink($old)); - } - } - public function shouldAppearInPropertyView() { return true; } diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php index 0bdb0d2151..08c66c7fa5 100644 --- a/src/applications/differential/storage/DifferentialTransaction.php +++ b/src/applications/differential/storage/DifferentialTransaction.php @@ -37,6 +37,8 @@ final class DifferentialTransaction return new DifferentialRevisionTitleTransaction(); case 'differential:test-plan': return new DifferentialRevisionTestPlanTransaction(); + case 'differential:repository': + return new DifferentialRevisionRepositoryTransaction(); } }