Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13957277
D8677.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D8677.diff
View Options
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
@@ -1,8 +1,5 @@
<?php
-/**
- * @group maniphest
- */
final class ManiphestBatchEditController extends ManiphestController {
public function processRequest() {
@@ -65,6 +62,25 @@
$template = new AphrontTokenizerTemplateView();
$template = $template->render();
+ $first_task = head($tasks);
+ $policies = id(new PhabricatorPolicyQuery())
+ ->setViewer($user)
+ ->setObject($first_task)
+ ->execute();
+print_r($policies);
+ $edit_policy_control = id(new AphrontFormPolicyControl())
+ ->setUser($user)
+ ->setCapability(PhabricatorPolicyCapability::CAN_EDIT)
+ ->setPolicyObject($first_task)
+ ->setPolicies($policies)
+ ->setName('edit_policy');
+ $view_policy_control = id(new AphrontFormPolicyControl())
+ ->setUser($user)
+ ->setCapability(PhabricatorPolicyCapability::CAN_VIEW)
+ ->setPolicyObject($first_task)
+ ->setPolicies($policies)
+ ->setName('view_policy');
+
require_celerity_resource('maniphest-batch-editor');
Javelin::initBehavior(
'maniphest-batch-editor',
@@ -86,9 +102,12 @@
'placeholder' => pht('Type a user name...'),
)
),
+ 'editPolicyControl' => $edit_policy_control,
+ 'viewPolicyControl' => $view_policy_control,
'input' => 'batch-form-actions',
'priorityMap' => ManiphestTaskPriority::getTaskPriorityMap(),
'statusMap' => ManiphestTaskStatus::getTaskStatusMap(),
+ 'actionMap' => $this->getActionMap(),
));
$form = new AphrontFormView();
@@ -171,6 +190,8 @@
'remove_project' => ManiphestTransaction::TYPE_PROJECTS,
'add_ccs' => ManiphestTransaction::TYPE_CCS,
'remove_ccs' => ManiphestTransaction::TYPE_CCS,
+ 'view_policy' => PhabricatorTransactions::TYPE_VIEW_POLICY,
+ 'edit_policy' => PhabricatorTransactions::TYPE_EDIT_POLICY,
);
$edge_edit_types = array(
@@ -216,6 +237,12 @@
case ManiphestTransaction::TYPE_CCS:
$current = $task->getCCPHIDs();
break;
+ case PhabricatorTransactions::TYPE_VIEW_POLICY:
+ $current = $task->getViewPolicy();
+ break;
+ case PhabricatorTransactions::TYPE_EDIT_POLICY:
+ $current = $task->getEditPolicy();
+ break;
}
}
@@ -249,6 +276,12 @@
continue 2;
}
break;
+ case PhabricatorTransactions::TYPE_VIEW_POLICY:
+ case PhabricatorTransactions::TYPE_EDIT_POLICY:
+ if (empty($value)) {
+ continue 2;
+ }
+ break;
}
// If the edit doesn't change anything, go to the next action. This
@@ -335,4 +368,18 @@
return $xactions;
}
+ private function getActionMap() {
+ return array(
+ 'add_project' => pht('Add Projects'),
+ 'remove_project' => pht('Remove Projects'),
+ 'priority' => pht('Change Priority'),
+ 'status' => pht('Change Status'),
+ 'add_comment' => pht('Comment'),
+ 'assign' => pht('Assign'),
+ 'add_ccs' => pht('Add CCs'),
+ 'remove_ccs' => pht('Remove CCs'),
+ 'view_policy' => pht('Change View Policy'),
+ 'edit_policy' => pht('Change Edit Policy'));
+ }
+
}
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
@@ -19,18 +19,7 @@
function renderRow(data) {
- 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'
- });
-
+ var action_select = JX.Prefab.renderSelect(config.actionMap);
var proj_tokenizer = build_tokenizer(config.sources.project);
var owner_tokenizer = build_tokenizer(config.sources.owner);
var cc_tokenizer = build_tokenizer(config.sources.cc);
@@ -38,6 +27,8 @@
var priority_select = JX.Prefab.renderSelect(config.priorityMap);
var status_select = JX.Prefab.renderSelect(config.statusMap);
var comment_input = JX.$N('input', {style: {width: '100%'}});
+ var edit_policy = JX.$H(config.editPolicyControl);
+ var view_policy = JX.$H(config.viewPolicyControl);
var cell = JX.$N('td', {className: 'batch-editor-input'});
var vfunc = null;
@@ -78,6 +69,11 @@
JX.DOM.setContent(cell, status_select);
vfunc = function() { return status_select.value; };
break;
+ case 'view_policy':
+ JX.DOM.setContent(cell, view_policy);
+ case 'edit_policy':
+ JX.DOM.setContent(cell, edit_policy);
+ break;
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 15 2024, 9:14 AM (4 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6709923
Default Alt Text
D8677.diff (5 KB)
Attached To
Mode
D8677: Halp - how get policy control into batch editor?
Attached
Detach File
Event Timeline
Log In to Comment