Limit some workflow elements to moderators
Allows to streamline triaging and keeping track of reports status, together with removing confusing elements which non-moderators can not use anyway.
This commit is contained in:
@@ -18,6 +18,10 @@ final class PhabricatorFavoritesMainMenuBarExtension
|
||||
public function buildMainMenus() {
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
if ($viewer->limitNonContributorUI()) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$dropdown = $this->newDropdown($viewer);
|
||||
if (!$dropdown) {
|
||||
return array();
|
||||
|
@@ -353,6 +353,18 @@ EODOCS
|
||||
continue;
|
||||
}
|
||||
|
||||
// Blender: limit task reopen to contributors.
|
||||
//
|
||||
// NOTE: Similar to other semantic check here we don't do it in the
|
||||
// Conduit.
|
||||
$viewer = $this->getViewer();
|
||||
if (ManiphestTaskStatus::isClosedStatus($current_status) &&
|
||||
ManiphestTaskStatus::isOpenStatus($status) &&
|
||||
$viewer->limitNonContributorUI()) {
|
||||
unset($status_map[$status]);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't allow tasks to be changed directly into "Closed, Duplicate"
|
||||
// status. Instead, you have to merge them. See T4819.
|
||||
if ($status == $dup_status) {
|
||||
@@ -382,6 +394,18 @@ EODOCS
|
||||
continue;
|
||||
}
|
||||
|
||||
// Blender: limit triaging to contributors.
|
||||
//
|
||||
// NOTE: Similar to other semantic check here we don't do it in the
|
||||
// Conduit.
|
||||
$viewer = $this->getViewer();
|
||||
if ($priority != $current_priority) {
|
||||
if (array_search('triage', $priority_keywords[$priority]) === false &&
|
||||
$viewer->limitNonContributorUI()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$keyword = head(idx($priority_keywords, $priority));
|
||||
$results[$keyword] = $priority_name;
|
||||
}
|
||||
|
@@ -1574,5 +1574,19 @@ final class PhabricatorUser
|
||||
return $list;
|
||||
}
|
||||
|
||||
// Blender: Limit certain workflow steps to regular contributors, making it
|
||||
// easier to follow status of the tracker.
|
||||
public function limitNonContributorUI() {
|
||||
if ($this->getIsAdmin()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$project = id(new PhabricatorProjectQuery())
|
||||
->setViewer($this)
|
||||
->withNames(array('Moderators'))
|
||||
->withMemberPHIDs(array($this->getPHID()))
|
||||
->executeOne();
|
||||
|
||||
return is_null($project);
|
||||
}
|
||||
}
|
||||
|
@@ -178,8 +178,10 @@ final class PhabricatorProjectBoardViewController
|
||||
$panel->addClass('project-panel-hidden');
|
||||
}
|
||||
|
||||
$column_menu = $this->buildColumnMenu($project, $column);
|
||||
$panel->addHeaderAction($column_menu);
|
||||
if (!$viewer->limitNonContributorUI()) {
|
||||
$column_menu = $this->buildColumnMenu($project, $column);
|
||||
$panel->addHeaderAction($column_menu);
|
||||
}
|
||||
|
||||
if ($column->canHaveTrigger()) {
|
||||
$trigger = $column->getTrigger();
|
||||
|
Reference in New Issue
Block a user