1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Add reviewers workflow fixes.

This commit is contained in:
epriestley 2011-02-04 22:45:42 -08:00
parent a35ae4c2a0
commit 18c0515440
7 changed files with 142 additions and 47 deletions

View file

@ -136,7 +136,7 @@ celerity_register_resource_map(array(
), ),
'differential-revision-comment-css' => 'differential-revision-comment-css' =>
array( array(
'uri' => '/res/274eb3f1/rsrc/css/application/differential/revision-comment.css', 'uri' => '/res/678be39a/rsrc/css/application/differential/revision-comment.css',
'type' => 'css', 'type' => 'css',
'requires' => 'requires' =>
array( array(
@ -181,7 +181,7 @@ celerity_register_resource_map(array(
), ),
'phabricator-core-buttons-css' => 'phabricator-core-buttons-css' =>
array( array(
'uri' => '/res/6e348ba4/rsrc/css/core/buttons.css', 'uri' => '/res/fe74ba44/rsrc/css/core/buttons.css',
'type' => 'css', 'type' => 'css',
'requires' => 'requires' =>
array( array(
@ -243,6 +243,16 @@ celerity_register_resource_map(array(
), ),
'disk' => '/rsrc/js/application/core/behavior-tokenizer.js', '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' => 'javelin-behavior-differential-feedback-preview' =>
array( array(
'uri' => '/res/8695d8b8/rsrc/js/application/differential/behavior-comment-preview.js', 'uri' => '/res/8695d8b8/rsrc/js/application/differential/behavior-comment-preview.js',
@ -368,7 +378,7 @@ celerity_register_resource_map(array(
), array ( ), array (
'packages' => 'packages' =>
array ( array (
'85861df3' => '20cc4391' =>
array ( array (
'name' => 'core.pkg.css', 'name' => 'core.pkg.css',
'symbols' => 'symbols' =>
@ -387,10 +397,10 @@ celerity_register_resource_map(array(
11 => 'phabricator-remarkup-css', 11 => 'phabricator-remarkup-css',
12 => 'syntax-highlighting-css', 12 => 'syntax-highlighting-css',
), ),
'uri' => '/res/pkg/85861df3/core.pkg.css', 'uri' => '/res/pkg/20cc4391/core.pkg.css',
'type' => 'css', 'type' => 'css',
), ),
'86498b42' => '33e57258' =>
array ( array (
'name' => 'differential.pkg.css', 'name' => 'differential.pkg.css',
'symbols' => 'symbols' =>
@ -404,7 +414,7 @@ celerity_register_resource_map(array(
6 => 'differential-revision-add-comment-css', 6 => 'differential-revision-add-comment-css',
7 => 'differential-revision-comment-list-css', 7 => 'differential-revision-comment-list-css',
), ),
'uri' => '/res/pkg/86498b42/differential.pkg.css', 'uri' => '/res/pkg/33e57258/differential.pkg.css',
'type' => 'css', 'type' => 'css',
), ),
'30d594cf' => '30d594cf' =>
@ -424,27 +434,27 @@ celerity_register_resource_map(array(
), ),
'reverse' => 'reverse' =>
array ( array (
'phabricator-core-css' => '85861df3', 'phabricator-core-css' => '20cc4391',
'phabricator-core-buttons-css' => '85861df3', 'phabricator-core-buttons-css' => '20cc4391',
'phabricator-standard-page-view' => '85861df3', 'phabricator-standard-page-view' => '20cc4391',
'aphront-dialog-view-css' => '85861df3', 'aphront-dialog-view-css' => '20cc4391',
'aphront-form-view-css' => '85861df3', 'aphront-form-view-css' => '20cc4391',
'aphront-panel-view-css' => '85861df3', 'aphront-panel-view-css' => '20cc4391',
'aphront-side-nav-view-css' => '85861df3', 'aphront-side-nav-view-css' => '20cc4391',
'aphront-table-view-css' => '85861df3', 'aphront-table-view-css' => '20cc4391',
'aphront-tokenizer-control-css' => '85861df3', 'aphront-tokenizer-control-css' => '20cc4391',
'aphront-typeahead-control-css' => '85861df3', 'aphront-typeahead-control-css' => '20cc4391',
'phabricator-directory-css' => '85861df3', 'phabricator-directory-css' => '20cc4391',
'phabricator-remarkup-css' => '85861df3', 'phabricator-remarkup-css' => '20cc4391',
'syntax-highlighting-css' => '85861df3', 'syntax-highlighting-css' => '20cc4391',
'differential-core-view-css' => '86498b42', 'differential-core-view-css' => '33e57258',
'differential-changeset-view-css' => '86498b42', 'differential-changeset-view-css' => '33e57258',
'differential-revision-detail-css' => '86498b42', 'differential-revision-detail-css' => '33e57258',
'differential-revision-history-css' => '86498b42', 'differential-revision-history-css' => '33e57258',
'differential-table-of-contents-css' => '86498b42', 'differential-table-of-contents-css' => '33e57258',
'differential-revision-comment-css' => '86498b42', 'differential-revision-comment-css' => '33e57258',
'differential-revision-add-comment-css' => '86498b42', 'differential-revision-add-comment-css' => '33e57258',
'differential-revision-comment-list-css' => '86498b42', 'differential-revision-comment-list-css' => '33e57258',
'javelin-behavior-differential-feedback-preview' => '30d594cf', 'javelin-behavior-differential-feedback-preview' => '30d594cf',
'javelin-behavior-differential-edit-inline-comments' => '30d594cf', 'javelin-behavior-differential-edit-inline-comments' => '30d594cf',
'javelin-behavior-differential-populate' => '30d594cf', 'javelin-behavior-differential-populate' => '30d594cf',

View file

@ -134,7 +134,7 @@ class DifferentialCommentEditor {
->save(); ->save();
if (!isset($reviewer_phids[$actor_phid])) { if (!isset($reviewer_phids[$actor_phid])) {
DifferentialRevisionEditor::addReviewers( DifferentialRevisionEditor::alterReviewers(
$revision, $revision,
$reviewer_phids, $reviewer_phids,
$rem = array(), $rem = array(),
@ -170,7 +170,7 @@ class DifferentialCommentEditor {
} }
if (!isset($reviewer_phids[$actor_phid])) { if (!isset($reviewer_phids[$actor_phid])) {
DifferentialRevisionEditor::addReviewers( DifferentialRevisionEditor::alterReviewers(
$revision, $revision,
$reviewer_phids, $reviewer_phids,
$rem = array(), $rem = array(),
@ -214,16 +214,16 @@ class DifferentialCommentEditor {
$added_reviewers = array_unique($added_reviewers); $added_reviewers = array_unique($added_reviewers);
if ($added_reviewers) { if ($added_reviewers) {
DifferentialRevisionEditor::addReviewers( DifferentialRevisionEditor::alterReviewers(
$revision, $revision,
$reviewer_phids, $reviewer_phids,
$rem = array(), $rem = array(),
$add = $added_reviewers, $add = $added_reviewers,
$actor_phid); $actor_phid);
// TODO $handles = id(new PhabricatorObjectHandleData($added_reviewers))
// $unixnames = unixname_multi($added_reviewers); ->loadHandles();
$usernames = $added_reviewers; $usernames = mpull($handles, 'getName');
$this->message = $this->message =
'Added reviewers: '.implode(', ', $usernames)."\n\n". 'Added reviewers: '.implode(', ', $usernames)."\n\n".

View file

@ -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/mail/comment');
phutil_require_module('phabricator', 'applications/differential/storage/comment'); phutil_require_module('phabricator', 'applications/differential/storage/comment');
phutil_require_module('phabricator', 'applications/differential/storage/inlinecomment'); phutil_require_module('phabricator', 'applications/differential/storage/inlinecomment');
phutil_require_module('phabricator', 'applications/phid/handle/data');
phutil_require_module('phutil', 'utils'); phutil_require_module('phutil', 'utils');

View file

@ -63,6 +63,14 @@ final class DifferentialAddCommentView extends AphrontView {
->setName('action') ->setName('action')
->setID('comment-action') ->setID('comment-action')
->setOptions($actions)) ->setOptions($actions))
->appendChild(
id(new AphrontFormTokenizerControl())
->setLabel('Add Reviewers')
->setName('reviewers')
->setControlID('add-reviewers')
->setControlStyle('display: none')
->setID('add-reviewers-tokenizer')
->setDisableBehavior(true))
->appendChild( ->appendChild(
id(new AphrontFormTextAreaControl()) id(new AphrontFormTextAreaControl())
->setName('comment') ->setName('comment')
@ -72,6 +80,15 @@ final class DifferentialAddCommentView extends AphrontView {
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Comment')); ->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(); $rev_id = $revision->getID();
Javelin::initBehavior( Javelin::initBehavior(

View file

@ -25,6 +25,8 @@ abstract class AphrontFormControl extends AphrontView {
private $value; private $value;
private $disabled; private $disabled;
private $id; private $id;
private $controlID;
private $controlStyle;
public function setID($id) { public function setID($id) {
$this->id = $id; $this->id = $id;
@ -35,6 +37,24 @@ abstract class AphrontFormControl extends AphrontView {
return $this->id; 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) { public function setLabel($label) {
$this->label = $label; $this->label = $label;
return $this; return $this;
@ -143,13 +163,17 @@ abstract class AphrontFormControl extends AphrontView {
$caption = null; $caption = null;
} }
return return phutil_render_tag(
'<div class="aphront-form-control '.$custom_class.'">'. 'div',
array(
'class' => "aphront-form-control {$custom_class}",
'id' => $this->controlID,
'style' => $this->controlStyle,
),
$error. $error.
$label. $label.
$input. $input.
$caption. $caption.
'<div style="clear: both;"></div>'. '<div style="clear: both;"></div>');
'</div>';
} }
} }

View file

@ -19,12 +19,18 @@
class AphrontFormTokenizerControl extends AphrontFormControl { class AphrontFormTokenizerControl extends AphrontFormControl {
private $datasource; private $datasource;
private $disableBehvaior;
public function setDatasource($datasource) { public function setDatasource($datasource) {
$this->datasource = $datasource; $this->datasource = $datasource;
return $this; return $this;
} }
public function setDisableBehavior($disable) {
$this->disableBehavior = $disable;
return $this;
}
protected function getCustomControlClass() { protected function getCustomControlClass() {
return 'aphront-form-control-tokenizer'; return 'aphront-form-control-tokenizer';
} }
@ -53,13 +59,19 @@ class AphrontFormTokenizerControl extends AphrontFormControl {
'type' => 'text', 'type' => 'text',
)); ));
if ($this->getID()) {
$id = $this->getID();
} else {
$id = celerity_generate_unique_node_id(); $id = celerity_generate_unique_node_id();
}
if (!$this->disableBehavior) {
Javelin::initBehavior('aphront-basic-tokenizer', array( Javelin::initBehavior('aphront-basic-tokenizer', array(
'id' => $id, 'id' => $id,
'src' => $this->datasource, 'src' => $this->datasource,
'value' => $values, 'value' => $values,
)); ));
}
return phutil_render_tag( return phutil_render_tag(
'div', 'div',

View file

@ -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));
}
});
});