mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Remove "Primary Owner" from Owners
Summary: Ref T8320. This field doesn't have any special effects and has no reason to exist. Primary owners are always already owners. This makes one minor implicit change to Owners: it is now possible to create a package with no owners. That seems fine; it is reasonable to create a package purely as an organizational tool and use it in, e.g., Herald. Test Plan: Created and edited packages. Reviewers: chad Reviewed By: chad Maniphest Tasks: T8320 Differential Revision: https://secure.phabricator.com/D13921
This commit is contained in:
parent
a3393c3ecb
commit
fd61702d6e
6 changed files with 4 additions and 78 deletions
|
@ -110,7 +110,6 @@ final class OwnersQueryConduitAPIMethod extends OwnersConduitAPIMethod {
|
|||
'phid' => $package->getPHID(),
|
||||
'name' => $package->getName(),
|
||||
'description' => $package->getDescription(),
|
||||
'primaryOwner' => $package->getPrimaryOwnerPHID(),
|
||||
'owners' => $owners,
|
||||
'paths' => $paths,
|
||||
);
|
||||
|
|
|
@ -150,14 +150,6 @@ final class PhabricatorOwnersDetailController
|
|||
$view = id(new PHUIPropertyListView())
|
||||
->setUser($viewer);
|
||||
|
||||
$primary_phid = $package->getPrimaryOwnerPHID();
|
||||
if ($primary_phid) {
|
||||
$primary_owner = $viewer->renderHandle($primary_phid);
|
||||
} else {
|
||||
$primary_owner = phutil_tag('em', array(), pht('None'));
|
||||
}
|
||||
$view->addProperty(pht('Primary Owner'), $primary_owner);
|
||||
|
||||
// TODO: needOwners() this on the Query.
|
||||
$owners = $package->loadOwners();
|
||||
if ($owners) {
|
||||
|
|
|
@ -28,10 +28,8 @@ final class PhabricatorOwnersEditController
|
|||
}
|
||||
|
||||
$e_name = true;
|
||||
$e_primary = true;
|
||||
|
||||
$v_name = $package->getName();
|
||||
$v_primary = $package->getPrimaryOwnerPHID();
|
||||
// TODO: Pull these off needOwners() on the Query.
|
||||
$v_owners = mpull($package->loadOwners(), 'getUserPHID');
|
||||
$v_auditing = $package->getAuditingEnabled();
|
||||
|
@ -43,18 +41,11 @@ final class PhabricatorOwnersEditController
|
|||
$xactions = array();
|
||||
|
||||
$v_name = $request->getStr('name');
|
||||
$v_primary = head($request->getArr('primary'));
|
||||
$v_owners = $request->getArr('owners');
|
||||
$v_auditing = ($request->getStr('auditing') == 'enabled');
|
||||
$v_description = $request->getStr('description');
|
||||
|
||||
if ($v_primary) {
|
||||
$v_owners[] = $v_primary;
|
||||
$v_owners = array_unique($v_owners);
|
||||
}
|
||||
|
||||
$type_name = PhabricatorOwnersPackageTransaction::TYPE_NAME;
|
||||
$type_primary = PhabricatorOwnersPackageTransaction::TYPE_PRIMARY;
|
||||
$type_owners = PhabricatorOwnersPackageTransaction::TYPE_OWNERS;
|
||||
$type_auditing = PhabricatorOwnersPackageTransaction::TYPE_AUDITING;
|
||||
$type_description = PhabricatorOwnersPackageTransaction::TYPE_DESCRIPTION;
|
||||
|
@ -63,10 +54,6 @@ final class PhabricatorOwnersEditController
|
|||
->setTransactionType($type_name)
|
||||
->setNewValue($v_name);
|
||||
|
||||
$xactions[] = id(new PhabricatorOwnersPackageTransaction())
|
||||
->setTransactionType($type_primary)
|
||||
->setNewValue($v_primary);
|
||||
|
||||
$xactions[] = id(new PhabricatorOwnersPackageTransaction())
|
||||
->setTransactionType($type_owners)
|
||||
->setNewValue($v_owners);
|
||||
|
@ -102,16 +89,9 @@ final class PhabricatorOwnersEditController
|
|||
$validation_exception = $ex;
|
||||
|
||||
$e_name = $ex->getShortMessage($type_name);
|
||||
$e_primary = $ex->getShortMessage($type_primary);
|
||||
}
|
||||
}
|
||||
|
||||
if ($v_primary) {
|
||||
$value_primary_owner = array($v_primary);
|
||||
} else {
|
||||
$value_primary_owner = array();
|
||||
}
|
||||
|
||||
if ($is_new) {
|
||||
$cancel_uri = '/owners/';
|
||||
$title = pht('New Package');
|
||||
|
@ -130,14 +110,6 @@ final class PhabricatorOwnersEditController
|
|||
->setName('name')
|
||||
->setValue($v_name)
|
||||
->setError($e_name))
|
||||
->appendControl(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
->setDatasource(new PhabricatorProjectOrUserDatasource())
|
||||
->setLabel(pht('Primary Owner'))
|
||||
->setName('primary')
|
||||
->setLimit(1)
|
||||
->setValue($value_primary_owner)
|
||||
->setError($e_primary))
|
||||
->appendControl(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
->setDatasource(new PhabricatorProjectOrUserDatasource())
|
||||
|
|
|
@ -15,7 +15,6 @@ final class PhabricatorOwnersPackageTransactionEditor
|
|||
$types = parent::getTransactionTypes();
|
||||
|
||||
$types[] = PhabricatorOwnersPackageTransaction::TYPE_NAME;
|
||||
$types[] = PhabricatorOwnersPackageTransaction::TYPE_PRIMARY;
|
||||
$types[] = PhabricatorOwnersPackageTransaction::TYPE_OWNERS;
|
||||
$types[] = PhabricatorOwnersPackageTransaction::TYPE_AUDITING;
|
||||
$types[] = PhabricatorOwnersPackageTransaction::TYPE_DESCRIPTION;
|
||||
|
@ -31,8 +30,6 @@ final class PhabricatorOwnersPackageTransactionEditor
|
|||
switch ($xaction->getTransactionType()) {
|
||||
case PhabricatorOwnersPackageTransaction::TYPE_NAME:
|
||||
return $object->getName();
|
||||
case PhabricatorOwnersPackageTransaction::TYPE_PRIMARY:
|
||||
return $object->getPrimaryOwnerPHID();
|
||||
case PhabricatorOwnersPackageTransaction::TYPE_OWNERS:
|
||||
// TODO: needOwners() this on the Query.
|
||||
$phids = mpull($object->loadOwners(), 'getUserPHID');
|
||||
|
@ -54,7 +51,6 @@ final class PhabricatorOwnersPackageTransactionEditor
|
|||
|
||||
switch ($xaction->getTransactionType()) {
|
||||
case PhabricatorOwnersPackageTransaction::TYPE_NAME:
|
||||
case PhabricatorOwnersPackageTransaction::TYPE_PRIMARY:
|
||||
case PhabricatorOwnersPackageTransaction::TYPE_DESCRIPTION:
|
||||
case PhabricatorOwnersPackageTransaction::TYPE_PATHS:
|
||||
return $xaction->getNewValue();
|
||||
|
@ -94,9 +90,6 @@ final class PhabricatorOwnersPackageTransactionEditor
|
|||
case PhabricatorOwnersPackageTransaction::TYPE_NAME:
|
||||
$object->setName($xaction->getNewValue());
|
||||
return;
|
||||
case PhabricatorOwnersPackageTransaction::TYPE_PRIMARY:
|
||||
$object->setPrimaryOwnerPHID($xaction->getNewValue());
|
||||
return;
|
||||
case PhabricatorOwnersPackageTransaction::TYPE_DESCRIPTION:
|
||||
$object->setDescription($xaction->getNewValue());
|
||||
return;
|
||||
|
@ -117,7 +110,6 @@ final class PhabricatorOwnersPackageTransactionEditor
|
|||
|
||||
switch ($xaction->getTransactionType()) {
|
||||
case PhabricatorOwnersPackageTransaction::TYPE_NAME:
|
||||
case PhabricatorOwnersPackageTransaction::TYPE_PRIMARY:
|
||||
case PhabricatorOwnersPackageTransaction::TYPE_DESCRIPTION:
|
||||
case PhabricatorOwnersPackageTransaction::TYPE_AUDITING:
|
||||
return;
|
||||
|
@ -200,22 +192,6 @@ final class PhabricatorOwnersPackageTransactionEditor
|
|||
$errors[] = $error;
|
||||
}
|
||||
break;
|
||||
case PhabricatorOwnersPackageTransaction::TYPE_PRIMARY:
|
||||
$missing = $this->validateIsEmptyTextField(
|
||||
$object->getPrimaryOwnerPHID(),
|
||||
$xactions);
|
||||
|
||||
if ($missing) {
|
||||
$error = new PhabricatorApplicationTransactionValidationError(
|
||||
$type,
|
||||
pht('Required'),
|
||||
pht('Packages must have a primary owner.'),
|
||||
nonempty(last($xactions), null));
|
||||
|
||||
$error->setIsMissingFieldError(true);
|
||||
$errors[] = $error;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $errors;
|
||||
|
@ -245,7 +221,6 @@ final class PhabricatorOwnersPackageTransactionEditor
|
|||
|
||||
protected function getMailTo(PhabricatorLiskDAO $object) {
|
||||
return array(
|
||||
$object->getPrimaryOwnerPHID(),
|
||||
$this->requireActor()->getPHID(),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -17,8 +17,7 @@ final class PhabricatorOwnersPackage
|
|||
|
||||
public static function initializeNewPackage(PhabricatorUser $actor) {
|
||||
return id(new PhabricatorOwnersPackage())
|
||||
->setAuditingEnabled(0)
|
||||
->setPrimaryOwnerPHID($actor->getPHID());
|
||||
->setAuditingEnabled(0);
|
||||
}
|
||||
|
||||
public function getCapabilities() {
|
||||
|
|
|
@ -25,14 +25,6 @@ final class PhabricatorOwnersPackageTransaction
|
|||
$new = $this->getNewValue();
|
||||
|
||||
switch ($this->getTransactionType()) {
|
||||
case self::TYPE_PRIMARY:
|
||||
if ($old) {
|
||||
$phids[] = $old;
|
||||
}
|
||||
if ($new) {
|
||||
$phids[] = $new;
|
||||
}
|
||||
break;
|
||||
case self::TYPE_OWNERS:
|
||||
$add = array_diff($new, $old);
|
||||
foreach ($add as $phid) {
|
||||
|
@ -55,6 +47,9 @@ final class PhabricatorOwnersPackageTransaction
|
|||
switch ($this->getTransactionType()) {
|
||||
case self::TYPE_DESCRIPTION:
|
||||
return ($old === null);
|
||||
case self::TYPE_PRIMARY:
|
||||
// TODO: Eventually, remove these transactions entirely.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,12 +71,6 @@ final class PhabricatorOwnersPackageTransaction
|
|||
$old,
|
||||
$new);
|
||||
}
|
||||
case self::TYPE_PRIMARY:
|
||||
return pht(
|
||||
'%s changed the primary owner for this package from %s to %s.',
|
||||
$this->renderHandleLink($author_phid),
|
||||
$this->renderHandleLink($old),
|
||||
$this->renderHandleLink($new));
|
||||
case self::TYPE_OWNERS:
|
||||
$add = array_diff($new, $old);
|
||||
$rem = array_diff($old, $new);
|
||||
|
|
Loading…
Reference in a new issue