mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 21:40:55 +01:00
Add reviewers workflow fixes.
This commit is contained in:
parent
a35ae4c2a0
commit
18c0515440
7 changed files with 142 additions and 47 deletions
|
@ -136,7 +136,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'differential-revision-comment-css' =>
|
||||
array(
|
||||
'uri' => '/res/274eb3f1/rsrc/css/application/differential/revision-comment.css',
|
||||
'uri' => '/res/678be39a/rsrc/css/application/differential/revision-comment.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -181,7 +181,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'phabricator-core-buttons-css' =>
|
||||
array(
|
||||
'uri' => '/res/6e348ba4/rsrc/css/core/buttons.css',
|
||||
'uri' => '/res/fe74ba44/rsrc/css/core/buttons.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -243,6 +243,16 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'disk' => '/rsrc/js/application/core/behavior-tokenizer.js',
|
||||
),
|
||||
'javelin-behavior-differential-add-reviewers' =>
|
||||
array(
|
||||
'uri' => '/res/330154e4/rsrc/js/application/differential/behavior-add-reviewers.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
0 => 'javelin-lib-dev',
|
||||
),
|
||||
'disk' => '/rsrc/js/application/differential/behavior-add-reviewers.js',
|
||||
),
|
||||
'javelin-behavior-differential-feedback-preview' =>
|
||||
array(
|
||||
'uri' => '/res/8695d8b8/rsrc/js/application/differential/behavior-comment-preview.js',
|
||||
|
@ -368,7 +378,7 @@ celerity_register_resource_map(array(
|
|||
), array (
|
||||
'packages' =>
|
||||
array (
|
||||
'85861df3' =>
|
||||
'20cc4391' =>
|
||||
array (
|
||||
'name' => 'core.pkg.css',
|
||||
'symbols' =>
|
||||
|
@ -387,10 +397,10 @@ celerity_register_resource_map(array(
|
|||
11 => 'phabricator-remarkup-css',
|
||||
12 => 'syntax-highlighting-css',
|
||||
),
|
||||
'uri' => '/res/pkg/85861df3/core.pkg.css',
|
||||
'uri' => '/res/pkg/20cc4391/core.pkg.css',
|
||||
'type' => 'css',
|
||||
),
|
||||
'86498b42' =>
|
||||
'33e57258' =>
|
||||
array (
|
||||
'name' => 'differential.pkg.css',
|
||||
'symbols' =>
|
||||
|
@ -404,7 +414,7 @@ celerity_register_resource_map(array(
|
|||
6 => 'differential-revision-add-comment-css',
|
||||
7 => 'differential-revision-comment-list-css',
|
||||
),
|
||||
'uri' => '/res/pkg/86498b42/differential.pkg.css',
|
||||
'uri' => '/res/pkg/33e57258/differential.pkg.css',
|
||||
'type' => 'css',
|
||||
),
|
||||
'30d594cf' =>
|
||||
|
@ -424,27 +434,27 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'reverse' =>
|
||||
array (
|
||||
'phabricator-core-css' => '85861df3',
|
||||
'phabricator-core-buttons-css' => '85861df3',
|
||||
'phabricator-standard-page-view' => '85861df3',
|
||||
'aphront-dialog-view-css' => '85861df3',
|
||||
'aphront-form-view-css' => '85861df3',
|
||||
'aphront-panel-view-css' => '85861df3',
|
||||
'aphront-side-nav-view-css' => '85861df3',
|
||||
'aphront-table-view-css' => '85861df3',
|
||||
'aphront-tokenizer-control-css' => '85861df3',
|
||||
'aphront-typeahead-control-css' => '85861df3',
|
||||
'phabricator-directory-css' => '85861df3',
|
||||
'phabricator-remarkup-css' => '85861df3',
|
||||
'syntax-highlighting-css' => '85861df3',
|
||||
'differential-core-view-css' => '86498b42',
|
||||
'differential-changeset-view-css' => '86498b42',
|
||||
'differential-revision-detail-css' => '86498b42',
|
||||
'differential-revision-history-css' => '86498b42',
|
||||
'differential-table-of-contents-css' => '86498b42',
|
||||
'differential-revision-comment-css' => '86498b42',
|
||||
'differential-revision-add-comment-css' => '86498b42',
|
||||
'differential-revision-comment-list-css' => '86498b42',
|
||||
'phabricator-core-css' => '20cc4391',
|
||||
'phabricator-core-buttons-css' => '20cc4391',
|
||||
'phabricator-standard-page-view' => '20cc4391',
|
||||
'aphront-dialog-view-css' => '20cc4391',
|
||||
'aphront-form-view-css' => '20cc4391',
|
||||
'aphront-panel-view-css' => '20cc4391',
|
||||
'aphront-side-nav-view-css' => '20cc4391',
|
||||
'aphront-table-view-css' => '20cc4391',
|
||||
'aphront-tokenizer-control-css' => '20cc4391',
|
||||
'aphront-typeahead-control-css' => '20cc4391',
|
||||
'phabricator-directory-css' => '20cc4391',
|
||||
'phabricator-remarkup-css' => '20cc4391',
|
||||
'syntax-highlighting-css' => '20cc4391',
|
||||
'differential-core-view-css' => '33e57258',
|
||||
'differential-changeset-view-css' => '33e57258',
|
||||
'differential-revision-detail-css' => '33e57258',
|
||||
'differential-revision-history-css' => '33e57258',
|
||||
'differential-table-of-contents-css' => '33e57258',
|
||||
'differential-revision-comment-css' => '33e57258',
|
||||
'differential-revision-add-comment-css' => '33e57258',
|
||||
'differential-revision-comment-list-css' => '33e57258',
|
||||
'javelin-behavior-differential-feedback-preview' => '30d594cf',
|
||||
'javelin-behavior-differential-edit-inline-comments' => '30d594cf',
|
||||
'javelin-behavior-differential-populate' => '30d594cf',
|
||||
|
|
|
@ -134,7 +134,7 @@ class DifferentialCommentEditor {
|
|||
->save();
|
||||
|
||||
if (!isset($reviewer_phids[$actor_phid])) {
|
||||
DifferentialRevisionEditor::addReviewers(
|
||||
DifferentialRevisionEditor::alterReviewers(
|
||||
$revision,
|
||||
$reviewer_phids,
|
||||
$rem = array(),
|
||||
|
@ -170,7 +170,7 @@ class DifferentialCommentEditor {
|
|||
}
|
||||
|
||||
if (!isset($reviewer_phids[$actor_phid])) {
|
||||
DifferentialRevisionEditor::addReviewers(
|
||||
DifferentialRevisionEditor::alterReviewers(
|
||||
$revision,
|
||||
$reviewer_phids,
|
||||
$rem = array(),
|
||||
|
@ -214,16 +214,16 @@ class DifferentialCommentEditor {
|
|||
$added_reviewers = array_unique($added_reviewers);
|
||||
|
||||
if ($added_reviewers) {
|
||||
DifferentialRevisionEditor::addReviewers(
|
||||
DifferentialRevisionEditor::alterReviewers(
|
||||
$revision,
|
||||
$reviewer_phids,
|
||||
$rem = array(),
|
||||
$add = $added_reviewers,
|
||||
$actor_phid);
|
||||
|
||||
// TODO
|
||||
// $unixnames = unixname_multi($added_reviewers);
|
||||
$usernames = $added_reviewers;
|
||||
$handles = id(new PhabricatorObjectHandleData($added_reviewers))
|
||||
->loadHandles();
|
||||
$usernames = mpull($handles, 'getName');
|
||||
|
||||
$this->message =
|
||||
'Added reviewers: '.implode(', ', $usernames)."\n\n".
|
||||
|
|
|
@ -12,6 +12,7 @@ phutil_require_module('phabricator', 'applications/differential/editor/revision'
|
|||
phutil_require_module('phabricator', 'applications/differential/mail/comment');
|
||||
phutil_require_module('phabricator', 'applications/differential/storage/comment');
|
||||
phutil_require_module('phabricator', 'applications/differential/storage/inlinecomment');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
|
|
@ -63,6 +63,14 @@ final class DifferentialAddCommentView extends AphrontView {
|
|||
->setName('action')
|
||||
->setID('comment-action')
|
||||
->setOptions($actions))
|
||||
->appendChild(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
->setLabel('Add Reviewers')
|
||||
->setName('reviewers')
|
||||
->setControlID('add-reviewers')
|
||||
->setControlStyle('display: none')
|
||||
->setID('add-reviewers-tokenizer')
|
||||
->setDisableBehavior(true))
|
||||
->appendChild(
|
||||
id(new AphrontFormTextAreaControl())
|
||||
->setName('comment')
|
||||
|
@ -72,6 +80,15 @@ final class DifferentialAddCommentView extends AphrontView {
|
|||
id(new AphrontFormSubmitControl())
|
||||
->setValue('Comment'));
|
||||
|
||||
Javelin::initBehavior(
|
||||
'differential-add-reviewers',
|
||||
array(
|
||||
'src' => '/typeahead/common/users/',
|
||||
'tokenizer' => 'add-reviewers-tokenizer',
|
||||
'select' => 'comment-action',
|
||||
'row' => 'add-reviewers',
|
||||
));
|
||||
|
||||
$rev_id = $revision->getID();
|
||||
|
||||
Javelin::initBehavior(
|
||||
|
|
|
@ -25,6 +25,8 @@ abstract class AphrontFormControl extends AphrontView {
|
|||
private $value;
|
||||
private $disabled;
|
||||
private $id;
|
||||
private $controlID;
|
||||
private $controlStyle;
|
||||
|
||||
public function setID($id) {
|
||||
$this->id = $id;
|
||||
|
@ -35,6 +37,24 @@ abstract class AphrontFormControl extends AphrontView {
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
public function setControlID($control_id) {
|
||||
$this->controlID = $control_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getControlID() {
|
||||
return $this->controlID;
|
||||
}
|
||||
|
||||
public function setControlStyle($control_style) {
|
||||
$this->controlStyle = $control_style;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getControlStyle() {
|
||||
return $this->controlStyle;
|
||||
}
|
||||
|
||||
public function setLabel($label) {
|
||||
$this->label = $label;
|
||||
return $this;
|
||||
|
@ -143,13 +163,17 @@ abstract class AphrontFormControl extends AphrontView {
|
|||
$caption = null;
|
||||
}
|
||||
|
||||
return
|
||||
'<div class="aphront-form-control '.$custom_class.'">'.
|
||||
$error.
|
||||
$label.
|
||||
$input.
|
||||
$caption.
|
||||
'<div style="clear: both;"></div>'.
|
||||
'</div>';
|
||||
return phutil_render_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => "aphront-form-control {$custom_class}",
|
||||
'id' => $this->controlID,
|
||||
'style' => $this->controlStyle,
|
||||
),
|
||||
$error.
|
||||
$label.
|
||||
$input.
|
||||
$caption.
|
||||
'<div style="clear: both;"></div>');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,18 @@
|
|||
class AphrontFormTokenizerControl extends AphrontFormControl {
|
||||
|
||||
private $datasource;
|
||||
private $disableBehvaior;
|
||||
|
||||
public function setDatasource($datasource) {
|
||||
$this->datasource = $datasource;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDisableBehavior($disable) {
|
||||
$this->disableBehavior = $disable;
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function getCustomControlClass() {
|
||||
return 'aphront-form-control-tokenizer';
|
||||
}
|
||||
|
@ -53,13 +59,19 @@ class AphrontFormTokenizerControl extends AphrontFormControl {
|
|||
'type' => 'text',
|
||||
));
|
||||
|
||||
$id = celerity_generate_unique_node_id();
|
||||
if ($this->getID()) {
|
||||
$id = $this->getID();
|
||||
} else {
|
||||
$id = celerity_generate_unique_node_id();
|
||||
}
|
||||
|
||||
Javelin::initBehavior('aphront-basic-tokenizer', array(
|
||||
'id' => $id,
|
||||
'src' => $this->datasource,
|
||||
'value' => $values,
|
||||
));
|
||||
if (!$this->disableBehavior) {
|
||||
Javelin::initBehavior('aphront-basic-tokenizer', array(
|
||||
'id' => $id,
|
||||
'src' => $this->datasource,
|
||||
'value' => $values,
|
||||
));
|
||||
}
|
||||
|
||||
return phutil_render_tag(
|
||||
'div',
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* @provides javelin-behavior-differential-add-reviewers
|
||||
* @requires javelin-lib-dev
|
||||
*/
|
||||
|
||||
JX.behavior('differential-add-reviewers', function(config) {
|
||||
|
||||
var root = JX.$(config.tokenizer);
|
||||
var datasource = new JX.TypeaheadPreloadedSource(config.src);
|
||||
|
||||
var typeahead = new JX.Typeahead(root);
|
||||
typeahead.setDatasource(datasource);
|
||||
|
||||
var tokenizer = new JX.Tokenizer(root);
|
||||
tokenizer.setTypeahead(typeahead);
|
||||
tokenizer.start();
|
||||
|
||||
JX.DOM.listen(
|
||||
JX.$(config.select),
|
||||
'change',
|
||||
null,
|
||||
function(e) {
|
||||
if (JX.$(config.select).value == 'add_reviewers') {
|
||||
JX.DOM.show(JX.$(config.row));
|
||||
tokenizer.refresh();
|
||||
} else {
|
||||
JX.DOM.hide(JX.$(config.row));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in a new issue