Move "Lock Project" to a separate action

Summary:
Ref T10010. Three motivations:

  - Primarily: this makes conversion to EditEngine easier since I don't have to convert this weird control.
  - This probably needs to have "Lock", "Unlock" and "Use Parent Project Setting" values after subprojects? But maybe just locking any parent locks all the children? Anyway, doesn't make sense to put it on the main edit form if it's weird like this, I think, since we'll want some kind of explanatory text.
  - I probably want to move this to the "Members" tab anyway, and this won't be available on milestone projects at all.

Test Plan: Locked, unlocked, edited projects.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10010

Differential Revision: https://secure.phabricator.com/D14895
This commit is contained in:
epriestley
2015-12-27 06:56:15 -08:00
parent 11e53f2948
commit e8ddfad6db
5 changed files with 100 additions and 23 deletions

View File

@@ -106,6 +106,25 @@ final class PhabricatorProjectProfileController
->setWorkflow(true));
}
$can_lock = $can_edit && $this->hasApplicationCapability(
ProjectCanLockProjectsCapability::CAPABILITY);
if ($project->getIsMembershipLocked()) {
$lock_name = pht('Unlock Project');
$lock_icon = 'fa-unlock';
} else {
$lock_name = pht('Lock Project');
$lock_icon = 'fa-lock';
}
$view->addAction(
id(new PhabricatorActionView())
->setName($lock_name)
->setIcon($lock_icon)
->setHref($this->getApplicationURI("lock/{$id}/"))
->setDisabled(!$can_lock)
->setWorkflow(true));
$action = null;
if (!$project->isUserMember($viewer->getPHID())) {
$can_join = PhabricatorPolicyFilter::hasCapability(