Page MenuHomePhabricator

D14128.diff
No OneTemporary

D14128.diff

diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
@@ -377,7 +377,7 @@
$repository);
$view_parts = array();
- if (PhabricatorSpacesNamespaceQuery::getViewerSpacesExist($viewer)) {
+ if (PhabricatorSpacesNamespaceQuery::getViewerActiveSpacesExist($viewer)) {
$space_phid = PhabricatorSpacesNamespaceQuery::getObjectSpacePHID(
$repository);
$view_parts[] = $viewer->renderHandle($space_phid);
diff --git a/src/applications/maniphest/controller/ManiphestBatchEditController.php b/src/applications/maniphest/controller/ManiphestBatchEditController.php
--- a/src/applications/maniphest/controller/ManiphestBatchEditController.php
+++ b/src/applications/maniphest/controller/ManiphestBatchEditController.php
@@ -106,6 +106,8 @@
$owner_source->setViewer($viewer);
$spaces_source = id(new PhabricatorSpacesNamespaceDatasource())
->setViewer($viewer);
+ $spaces_active_spaces_exist = id(new PhabricatorSpacesNamespaceQuery())
+ ->getViewerActiveSpacesExist($viewer);
require_celerity_resource('maniphest-batch-editor');
Javelin::initBehavior(
@@ -138,6 +140,7 @@
),
),
'input' => 'batch-form-actions',
+ 'showSpaceSelect' => $spaces_active_spaces_exist,
'priorityMap' => ManiphestTaskPriority::getTaskPriorityMap(),
'statusMap' => ManiphestTaskStatus::getTaskStatusMap(),
));
diff --git a/src/applications/metamta/applicationpanel/PhabricatorMetaMTAApplicationEmailPanel.php b/src/applications/metamta/applicationpanel/PhabricatorMetaMTAApplicationEmailPanel.php
--- a/src/applications/metamta/applicationpanel/PhabricatorMetaMTAApplicationEmailPanel.php
+++ b/src/applications/metamta/applicationpanel/PhabricatorMetaMTAApplicationEmailPanel.php
@@ -239,7 +239,7 @@
->setValue($v_email)
->setError($e_email));
- if (PhabricatorSpacesNamespaceQuery::getViewerSpacesExist($viewer)) {
+ if (PhabricatorSpacesNamespaceQuery::getViewerActiveSpacesExist($viewer)) {
$form->appendControl(
id(new AphrontFormSelectControl())
->setLabel(pht('Space'))
@@ -395,7 +395,7 @@
$table->setRowClasses($rowc);
$table->setColumnVisibility(
array(
- PhabricatorSpacesNamespaceQuery::getViewerSpacesExist($viewer),
+ PhabricatorSpacesNamespaceQuery::getViewerActiveSpacesExist($viewer),
true,
$is_edit,
$is_edit,
diff --git a/src/applications/spaces/query/PhabricatorSpacesNamespaceQuery.php b/src/applications/spaces/query/PhabricatorSpacesNamespaceQuery.php
--- a/src/applications/spaces/query/PhabricatorSpacesNamespaceQuery.php
+++ b/src/applications/spaces/query/PhabricatorSpacesNamespaceQuery.php
@@ -103,6 +103,17 @@
return (count($spaces) > 1);
}
+ public static function getViewerActiveSpacesExist(PhabricatorUser $viewer) {
+ if (!self::getSpacesExist()) {
+ return false;
+ }
+
+ // If the viewer has access to only one active space, pretend active spaces
+ // simply don't exist.
+ $spaces = self::getViewerActiveSpaces($viewer);
+ return (count($spaces) > 1);
+ }
+
public static function getAllSpaces() {
$cache = PhabricatorCaches::getRequestCache();
$cache_key = self::KEY_ALL;
diff --git a/src/view/form/control/AphrontFormPolicyControl.php b/src/view/form/control/AphrontFormPolicyControl.php
--- a/src/view/form/control/AphrontFormPolicyControl.php
+++ b/src/view/form/control/AphrontFormPolicyControl.php
@@ -335,7 +335,7 @@
}
$viewer = $this->getUser();
- if (!PhabricatorSpacesNamespaceQuery::getViewerSpacesExist($viewer)) {
+ if (!PhabricatorSpacesNamespaceQuery::getViewerActiveSpacesExist($viewer)) {
return null;
}
diff --git a/webroot/rsrc/js/application/maniphest/behavior-batch-editor.js b/webroot/rsrc/js/application/maniphest/behavior-batch-editor.js
--- a/webroot/rsrc/js/application/maniphest/behavior-batch-editor.js
+++ b/webroot/rsrc/js/application/maniphest/behavior-batch-editor.js
@@ -15,23 +15,28 @@
var action_rows = [];
function renderRow() {
- var action_select = JX.Prefab.renderSelect(
- {
- 'add_project': 'Add Projects',
- 'remove_project' : 'Remove Projects',
- 'priority': 'Change Priority',
- 'status': 'Change Status',
- 'add_comment': 'Comment',
- 'assign': 'Assign',
- 'add_ccs' : 'Add CCs',
- 'remove_ccs' : 'Remove CCs',
- 'space': 'Shift to Space'
- });
+ var select_item = {
+ 'add_project': 'Add Projects',
+ 'remove_project' : 'Remove Projects',
+ 'priority': 'Change Priority',
+ 'status': 'Change Status',
+ 'add_comment': 'Comment',
+ 'assign': 'Assign',
+ 'add_ccs' : 'Add CCs',
+ 'remove_ccs' : 'Remove CCs'
+ };
+ if (config.showSpaceSelect) {
+ select_item['space'] = 'Shift to Space';
+ }
+ var action_select = JX.Prefab.renderSelect(select_item);
var proj_tokenizer = build_tokenizer(config.sources.project);
var owner_tokenizer = build_tokenizer(config.sources.owner);
var cc_tokenizer = build_tokenizer(config.sources.cc);
- var space_tokenizer = build_tokenizer(config.sources.spaces);
+
+ if (config.showSpaceSelect) {
+ var space_tokenizer = build_tokenizer(config.sources.spaces);
+ }
var priority_select = JX.Prefab.renderSelect(config.priorityMap);
var status_select = JX.Prefab.renderSelect(config.statusMap);

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 8, 8:08 AM (22 h, 7 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7311673
Default Alt Text
D14128.diff (5 KB)

Event Timeline