Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php
index 190cd9ad09..4ea5cbaa1c 100644
--- a/src/__celerity_resource_map__.php
+++ b/src/__celerity_resource_map__.php
@@ -1,454 +1,464 @@
<?php
/**
* This file is automatically generated. Use 'celerity_mapper.php' to rebuild
* it.
* @generated
*/
celerity_register_resource_map(array(
'aphront-dark-console-css' =>
array(
'uri' => '/res/056b0c12/rsrc/css/aphront/dark-console.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/aphront/dark-console.css',
),
'aphront-dialog-view-css' =>
array(
'uri' => '/res/a05107ae/rsrc/css/aphront/dialog-view.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/aphront/dialog-view.css',
),
'aphront-form-view-css' =>
array(
'uri' => '/res/785ac1c6/rsrc/css/aphront/form-view.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/aphront/form-view.css',
),
'aphront-panel-view-css' =>
array(
'uri' => '/res/63672373/rsrc/css/aphront/panel-view.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/aphront/panel-view.css',
),
'aphront-request-failure-view-css' =>
array(
'uri' => '/res/97b8337a/rsrc/css/aphront/request-failure-view.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/aphront/request-failure-view.css',
),
'aphront-side-nav-view-css' =>
array(
'uri' => '/res/0fc0545c/rsrc/css/aphront/side-nav-view.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/aphront/side-nav-view.css',
),
'aphront-table-view-css' =>
array(
'uri' => '/res/6a70f0f0/rsrc/css/aphront/table-view.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/aphront/table-view.css',
),
'aphront-tokenizer-control-css' =>
array(
'uri' => '/res/a3d23074/rsrc/css/aphront/tokenizer.css',
'type' => 'css',
'requires' =>
array(
0 => 'aphront-typeahead-control-css',
),
'disk' => '/rsrc/css/aphront/tokenizer.css',
),
'aphront-typeahead-control-css' =>
array(
'uri' => '/res/928df9f0/rsrc/css/aphront/typeahead.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/aphront/typeahead.css',
),
'phabricator-standard-page-view' =>
array(
'uri' => '/res/fb02fb0e/rsrc/css/application/base/standard-page-view.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/application/base/standard-page-view.css',
),
'differential-revision-add-comment-css' =>
array(
'uri' => '/res/9be761de/rsrc/css/application/differential/add-comment.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/application/differential/add-comment.css',
),
'differential-changeset-view-css' =>
array(
'uri' => '/res/8b893b8e/rsrc/css/application/differential/changeset-view.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/application/differential/changeset-view.css',
),
'differential-core-view-css' =>
array(
'uri' => '/res/525d1a12/rsrc/css/application/differential/core.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/application/differential/core.css',
),
'differential-revision-comment-list-css' =>
array(
'uri' => '/res/a1c117db/rsrc/css/application/differential/revision-comment-list.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/application/differential/revision-comment-list.css',
),
'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(
),
'disk' => '/rsrc/css/application/differential/revision-comment.css',
),
'differential-revision-detail-css' =>
array(
'uri' => '/res/230a67c6/rsrc/css/application/differential/revision-detail.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/application/differential/revision-detail.css',
),
'differential-revision-history-css' =>
array(
'uri' => '/res/755f3da3/rsrc/css/application/differential/revision-history.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/application/differential/revision-history.css',
),
'differential-table-of-contents-css' =>
array(
'uri' => '/res/e68f6f05/rsrc/css/application/differential/table-of-contents.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/application/differential/table-of-contents.css',
),
'phabricator-directory-css' =>
array(
'uri' => '/res/6a000601/rsrc/css/application/directory/phabricator-directory.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/application/directory/phabricator-directory.css',
),
'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(
),
'disk' => '/rsrc/css/core/buttons.css',
),
'phabricator-core-css' =>
array(
'uri' => '/res/41c62455/rsrc/css/core/core.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/core/core.css',
),
'phabricator-core-dialog-css' =>
array(
'uri' => '/res/f66cec41/rsrc/css/core/dialog.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/core/dialog.css',
),
'phabricator-remarkup-css' =>
array(
'uri' => '/res/786989c3/rsrc/css/core/remarkup.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/core/remarkup.css',
),
'syntax-highlighting-css' =>
array(
'uri' => '/res/fb673ece/rsrc/css/core/syntax.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/core/syntax.css',
),
'javelin-behavior-dark-console' =>
array(
'uri' => '/res/020b0265/rsrc/js/application/core/behavior-dark-console.js',
'type' => 'js',
'requires' =>
array(
),
'disk' => '/rsrc/js/application/core/behavior-dark-console.js',
),
'javelin-behavior-aphront-basic-tokenizer' =>
array(
'uri' => '/res/8317d761/rsrc/js/application/core/behavior-tokenizer.js',
'type' => 'js',
'requires' =>
array(
0 => 'javelin-lib-dev',
),
'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',
'type' => 'js',
'requires' =>
array(
0 => 'javelin-lib-dev',
),
'disk' => '/rsrc/js/application/differential/behavior-comment-preview.js',
),
'javelin-behavior-differential-diff-radios' =>
array(
'uri' => '/res/fdeb3823/rsrc/js/application/differential/behavior-diff-radios.js',
'type' => 'js',
'requires' =>
array(
0 => 'javelin-lib-dev',
),
'disk' => '/rsrc/js/application/differential/behavior-diff-radios.js',
),
'javelin-behavior-differential-edit-inline-comments' =>
array(
'uri' => '/res/74747b2e/rsrc/js/application/differential/behavior-edit-inline-comments.js',
'type' => 'js',
'requires' =>
array(
0 => 'javelin-lib-dev',
),
'disk' => '/rsrc/js/application/differential/behavior-edit-inline-comments.js',
),
'javelin-behavior-differential-populate' =>
array(
'uri' => '/res/a13dcd7e/rsrc/js/application/differential/behavior-populate.js',
'type' => 'js',
'requires' =>
array(
0 => 'javelin-lib-dev',
),
'disk' => '/rsrc/js/application/differential/behavior-populate.js',
),
'javelin-behavior-differential-show-more' =>
array(
'uri' => '/res/ea998002/rsrc/js/application/differential/behavior-show-more.js',
'type' => 'js',
'requires' =>
array(
0 => 'javelin-lib-dev',
),
'disk' => '/rsrc/js/application/differential/behavior-show-more.js',
),
'javelin-magical-init' =>
array(
'uri' => '/res/76614f84/rsrc/js/javelin/init.dev.js',
'type' => 'js',
'requires' =>
array(
),
'disk' => '/rsrc/js/javelin/init.dev.js',
),
'javelin-init-prod' =>
array(
'uri' => '/res/1267c868/rsrc/js/javelin/init.min.js',
'type' => 'js',
'requires' =>
array(
),
'disk' => '/rsrc/js/javelin/init.min.js',
),
'javelin-lib-dev' =>
array(
'uri' => '/res/a0e7a5e9/rsrc/js/javelin/javelin.dev.js',
'type' => 'js',
'requires' =>
array(
),
'disk' => '/rsrc/js/javelin/javelin.dev.js',
),
'javelin-lib-prod' =>
array(
'uri' => '/res/2f2b3b2e/rsrc/js/javelin/javelin.min.js',
'type' => 'js',
'requires' =>
array(
),
'disk' => '/rsrc/js/javelin/javelin.min.js',
),
'javelin-typeahead-dev' =>
array(
'uri' => '/res/6de6ae59/rsrc/js/javelin/typeahead.dev.js',
'type' => 'js',
'requires' =>
array(
),
'disk' => '/rsrc/js/javelin/typeahead.dev.js',
),
'javelin-typeahead-prod' =>
array(
'uri' => '/res/69d5fad1/rsrc/js/javelin/typeahead.min.js',
'type' => 'js',
'requires' =>
array(
),
'disk' => '/rsrc/js/javelin/typeahead.min.js',
),
'javelin-workflow-dev' =>
array(
'uri' => '/res/c6b17f93/rsrc/js/javelin/workflow.dev.js',
'type' => 'js',
'requires' =>
array(
),
'disk' => '/rsrc/js/javelin/workflow.dev.js',
),
'javelin-workflow-prod' =>
array(
'uri' => '/res/b758e0a0/rsrc/js/javelin/workflow.min.js',
'type' => 'js',
'requires' =>
array(
),
'disk' => '/rsrc/js/javelin/workflow.min.js',
),
), array (
'packages' =>
array (
- '85861df3' =>
+ '20cc4391' =>
array (
'name' => 'core.pkg.css',
'symbols' =>
array (
0 => 'phabricator-core-css',
1 => 'phabricator-core-buttons-css',
2 => 'phabricator-standard-page-view',
3 => 'aphront-dialog-view-css',
4 => 'aphront-form-view-css',
5 => 'aphront-panel-view-css',
6 => 'aphront-side-nav-view-css',
7 => 'aphront-table-view-css',
8 => 'aphront-tokenizer-control-css',
9 => 'aphront-typeahead-control-css',
10 => 'phabricator-directory-css',
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' =>
array (
0 => 'differential-core-view-css',
1 => 'differential-changeset-view-css',
2 => 'differential-revision-detail-css',
3 => 'differential-revision-history-css',
4 => 'differential-table-of-contents-css',
5 => 'differential-revision-comment-css',
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' =>
array (
'name' => 'differential.pkg.js',
'symbols' =>
array (
0 => 'javelin-behavior-differential-feedback-preview',
1 => 'javelin-behavior-differential-edit-inline-comments',
2 => 'javelin-behavior-differential-populate',
3 => 'javelin-behavior-differential-show-more',
4 => 'javelin-behavior-differential-diff-radios',
),
'uri' => '/res/pkg/30d594cf/differential.pkg.js',
'type' => 'js',
),
),
'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',
'javelin-behavior-differential-show-more' => '30d594cf',
'javelin-behavior-differential-diff-radios' => '30d594cf',
),
));
diff --git a/src/applications/differential/editor/comment/DifferentialCommentEditor.php b/src/applications/differential/editor/comment/DifferentialCommentEditor.php
index 6a3e22960c..fd2f42eb04 100755
--- a/src/applications/differential/editor/comment/DifferentialCommentEditor.php
+++ b/src/applications/differential/editor/comment/DifferentialCommentEditor.php
@@ -1,327 +1,327 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class DifferentialCommentEditor {
protected $revision;
protected $actorPHID;
protected $action;
protected $attachInlineComments;
protected $message;
protected $addCC;
protected $changedByCommit;
protected $addedReviewers = array();
public function __construct(
DifferentialRevision $revision,
$actor_phid,
$action) {
$this->revision = $revision;
$this->actorPHID = $actor_phid;
$this->action = $action;
}
public function setMessage($message) {
$this->message = $message;
return $this;
}
public function setAttachInlineComments($attach) {
$this->attachInlineComments = $attach;
return $this;
}
public function setAddCC($add) {
$this->addCC = $add;
return $this;
}
public function setChangedByCommit($changed_by_commit) {
$this->changedByCommit = $changed_by_commit;
return $this;
}
public function getChangedByCommit() {
return $this->changedByCommit;
}
public function setAddedReviewers($added_reviewers) {
$this->addedReviewers = $added_reviewers;
return $this;
}
public function getAddedReviewers() {
return $this->addedReviewers;
}
public function save() {
$revision = $this->revision;
$action = $this->action;
$actor_phid = $this->actorPHID;
$actor_is_author = ($actor_phid == $revision->getAuthorPHID());
$revision_status = $revision->getStatus();
$revision->loadRelationships();
$reviewer_phids = $revision->getReviewers();
if ($reviewer_phids) {
$reviewer_phids = array_combine($reviewer_phids, $reviewer_phids);
}
switch ($action) {
case DifferentialAction::ACTION_COMMENT:
break;
case DifferentialAction::ACTION_RESIGN:
if ($actor_is_author) {
throw new Exception('You can not resign from your own revision!');
}
if (isset($reviewer_phids[$actor_phid])) {
DifferentialRevisionEditor::alterReviewers(
$revision,
$reviewer_phids,
$rem = array($actor_phid),
$add = array(),
$actor_phid);
}
break;
case DifferentialAction::ACTION_ABANDON:
if (!$actor_is_author) {
throw new Exception('You can only abandon your revisions.');
}
if ($revision_status == DifferentialRevisionStatus::COMMITTED) {
throw new Exception('You can not abandon a committed revision.');
}
if ($revision_status == DifferentialRevisionStatus::ABANDONED) {
$action = DifferentialAction::ACTION_COMMENT;
break;
}
$revision
->setStatus(DifferentialRevisionStatus::ABANDONED)
->save();
break;
case DifferentialAction::ACTION_ACCEPT:
if ($actor_is_author) {
throw new Exception('You can not accept your own revision.');
}
if (($revision_status != DifferentialRevisionStatus::NEEDS_REVIEW) &&
($revision_status != DifferentialRevisionStatus::NEEDS_REVISION)) {
$action = DifferentialAction::ACTION_COMMENT;
break;
}
$revision
->setStatus(DifferentialRevisionStatus::ACCEPTED)
->save();
if (!isset($reviewer_phids[$actor_phid])) {
- DifferentialRevisionEditor::addReviewers(
+ DifferentialRevisionEditor::alterReviewers(
$revision,
$reviewer_phids,
$rem = array(),
$add = array($actor_phid),
$actor_phid);
}
break;
case DifferentialAction::ACTION_REQUEST:
if (!$actor_is_author) {
throw new Exception('You must own a revision to request review.');
}
if (($revision_status != DifferentialRevisionStatus::NEEDS_REVISION) &&
($revision_status != DifferentialRevisionStatus::ACCEPTED)) {
$action = DifferentialAction::ACTION_COMMENT;
break;
}
$revision
->setStatus(DifferentialRevisionStatus::NEEDS_REVIEW)
->save();
break;
case DifferentialAction::ACTION_REJECT:
if ($actor_is_author) {
throw new Exception(
'You can not request changes to your own revision.');
}
if (($revision_status != DifferentialRevisionStatus::NEEDS_REVIEW) &&
($revision_status != DifferentialRevisionStatus::ACCEPTED)) {
$action = DifferentialAction::ACTION_COMMENT;
break;
}
if (!isset($reviewer_phids[$actor_phid])) {
- DifferentialRevisionEditor::addReviewers(
+ DifferentialRevisionEditor::alterReviewers(
$revision,
$reviewer_phids,
$rem = array(),
$add = array($actor_phid),
$actor_phid);
}
$revision
->setStatus(DifferentialRevisionStatus::NEEDS_REVISION)
->save();
break;
case DifferentialAction::ACTION_RECLAIM:
if (!$actor_is_author) {
throw new Exception('You can not reclaim a revision you do not own.');
}
if ($revision_status != DifferentialRevisionStatus::ABANDONED) {
$action = DifferentialAction::ACTION_COMMENT;
break;
}
$revision
->setStatus(DifferentialRevisionStatus::NEEDS_REVIEW)
->save();
break;
case DifferentialAction::ACTION_COMMIT:
// This is handled externally. (TODO)
break;
case DifferentialAction::ACTION_ADDREVIEWERS:
$added_reviewers = $this->getAddedReviewers();
foreach ($added_reviewers as $k => $user_phid) {
if ($user_phid == $revision->getAuthorPHID()) {
unset($added_reviewers[$k]);
}
if (!empty($reviewer_phids[$user_phid])) {
unset($added_reviewers[$k]);
}
}
$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".
$this->message;
} else {
$action = DifferentialAction::ACTION_COMMENT;
}
break;
default:
throw new Exception('Unsupported action.');
}
// Reload relationships to pick up any reviewer changes.
$revision->loadRelationships();
$inline_comments = array();
if ($this->attachInlineComments) {
$inline_comments = id(new DifferentialInlineComment())->loadAllWhere(
'authorPHID = %s AND revisionID = %d AND commentID IS NULL',
$this->actorPHID,
$revision->getID());
}
$comment = id(new DifferentialComment())
->setAuthorPHID($this->actorPHID)
->setRevisionID($revision->getID())
->setAction($action)
->setContent((string)$this->message)
->save();
// $diff = id(new Diff())->loadActiveWithRevision($revision);
// $changesets = id(new DifferentialChangeset())->loadAllWithDiff($diff);
if ($inline_comments) {
/*
// We may have feedback on non-current changesets. Rather than orphaning
// it, just submit it. This is non-ideal but not horrible.
$inline_changeset_ids = array_pull($inline_comments, 'getChangesetID');
$load = array();
foreach ($inline_changeset_ids as $id) {
if (empty($changesets[$id])) {
$load[] = $id;
}
}
if ($load) {
$changesets += id(new DifferentialChangeset())->loadAllWithIDs($load);
}
*/
foreach ($inline_comments as $inline) {
$inline->setCommentID($comment->getID());
$inline->save();
}
}
id(new DifferentialCommentMail(
$revision,
$this->actorPHID,
$comment,
/* $changesets TODO */ array(),
/* $inline_comments TODO */ array()))
->setToPHIDs(
array_merge(
$revision->getReviewers(),
array($revision->getAuthorPHID())))
->setCCPHIDs($revision->getCCPHIDs())
->setChangedByCommit($this->getChangedByCommit())
->send();
/*
tODO
if ($this->addCC) {
require_module_lazy('site/tools/differential/lib/editor/revision');
DifferentialRevisionEditor::addCCFBID(
$revision,
$this->actorPHID,
$this->actorPHID);
}
*/
/*
TODO
$event = array(
'revision_id' => $revision->getID(),
'fbid' => $revision->getFBID(),
'feedback_id' => $feedback->getID(),
'action' => $feedback->getAction(),
'actor' => $this->actorPHID,
);
id(new ToolsTimelineEvent('difx', fb_json_encode($event)))->record();
*/
return $comment;
}
}
diff --git a/src/applications/differential/editor/comment/__init__.php b/src/applications/differential/editor/comment/__init__.php
index 1d14ca7092..11fbcdc6ba 100644
--- a/src/applications/differential/editor/comment/__init__.php
+++ b/src/applications/differential/editor/comment/__init__.php
@@ -1,19 +1,20 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/differential/constants/action');
phutil_require_module('phabricator', 'applications/differential/constants/revisionstatus');
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');
phutil_require_source('DifferentialCommentEditor.php');
diff --git a/src/applications/differential/view/addcomment/DifferentialAddCommentView.php b/src/applications/differential/view/addcomment/DifferentialAddCommentView.php
index a84e27ae51..b7f4a72895 100644
--- a/src/applications/differential/view/addcomment/DifferentialAddCommentView.php
+++ b/src/applications/differential/view/addcomment/DifferentialAddCommentView.php
@@ -1,106 +1,123 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
final class DifferentialAddCommentView extends AphrontView {
private $revision;
private $actions;
private $actionURI;
private $user;
public function setRevision($revision) {
$this->revision = $revision;
return $this;
}
public function setActions(array $actions) {
$this->actions = $actions;
return $this;
}
public function setActionURI($uri) {
$this->actionURI = $uri;
}
public function setUser(PhabricatorUser $user) {
$this->user = $user;
}
public function render() {
require_celerity_resource('differential-revision-add-comment-css');
$revision = $this->revision;
$actions = array();
foreach ($this->actions as $action) {
$actions[$action] = DifferentialAction::getActionVerb($action);
}
$form = new AphrontFormView();
$form
->setUser($this->user)
->setAction($this->actionURI)
->addHiddenInput('revision_id', $revision->getID())
->appendChild(
id(new AphrontFormSelectControl())
->setLabel('Action')
->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')
->setID('comment-content')
->setLabel('Comment'))
->appendChild(
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(
'differential-feedback-preview',
array(
'uri' => '/differential/comment/preview/'.$rev_id.'/',
'preview' => 'comment-preview',
'action' => 'comment-action',
'content' => 'comment-content',
'inlineuri' => '/differential/comment/inline/preview/'.$rev_id.'/',
'inline' => 'inline-comment-preview',
));
return
'<div class="differential-add-comment-panel">'.
'<div class="differential-panel">'.
'<h1>Add Comment</h1>'.
$form->render().
'</div>'.
'<div class="differential-comment-preview">'.
'<div id="comment-preview">'.
'<span class="differential-loading-text">'.
'Loading comment preview...'.
'</span>'.
'</div>'.
'<div id="inline-comment-preview">'.
'</div>'.
'</div>'.
'</div>';
}
}
diff --git a/src/view/form/control/base/AphrontFormControl.php b/src/view/form/control/base/AphrontFormControl.php
index 48c494b2d8..c90054cbde 100755
--- a/src/view/form/control/base/AphrontFormControl.php
+++ b/src/view/form/control/base/AphrontFormControl.php
@@ -1,155 +1,179 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
abstract class AphrontFormControl extends AphrontView {
private $label;
private $caption;
private $error;
private $name;
private $value;
private $disabled;
private $id;
+ private $controlID;
+ private $controlStyle;
public function setID($id) {
$this->id = $id;
return $this;
}
public function getID() {
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;
}
public function getLabel() {
return $this->label;
}
public function setCaption($caption) {
$this->caption = $caption;
return $this;
}
public function getCaption() {
return $this->caption;
}
public function setError($error) {
$this->error = $error;
return $this;
}
public function getError() {
return $this->error;
}
public function setName($name) {
$this->name = $name;
return $this;
}
public function getName() {
return $this->name;
}
public function setValue($value) {
$this->value = $value;
return $this;
}
public function getValue() {
return $this->value;
}
public function setDisabled($disabled) {
$this->disabled = $disabled;
return $this;
}
public function getDisabled() {
return $this->disabled;
}
abstract protected function renderInput();
abstract protected function getCustomControlClass();
protected function shouldRender() {
return true;
}
final public function render() {
if (!$this->shouldRender()) {
return null;
}
$custom_class = $this->getCustomControlClass();
if (strlen($this->getLabel())) {
$label =
'<label class="aphront-form-label">'.
phutil_escape_html($this->getLabel()).
':'.
'</label>';
} else {
$label = null;
$custom_class .= ' aphront-form-control-nolabel';
}
$input =
'<div class="aphront-form-input">'.
$this->renderInput().
'</div>';
if (strlen($this->getError())) {
$error = $this->getError();
if ($error === true) {
$error = '*';
} else {
$error = "\xC2\xAB ".$error;
}
$error =
'<div class="aphront-form-error">'.
phutil_escape_html($error).
'</div>';
} else {
$error = null;
}
if (strlen($this->getCaption())) {
$caption =
'<div class="aphront-form-caption">'.
$this->getCaption().
'</div>';
} else {
$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>');
}
}
diff --git a/src/view/form/control/tokenizer/AphrontFormTokenizerControl.php b/src/view/form/control/tokenizer/AphrontFormTokenizerControl.php
index c51e56f44a..bb0e272334 100755
--- a/src/view/form/control/tokenizer/AphrontFormTokenizerControl.php
+++ b/src/view/form/control/tokenizer/AphrontFormTokenizerControl.php
@@ -1,106 +1,118 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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';
}
protected function renderInput() {
require_celerity_resource('aphront-tokenizer-control-css');
require_celerity_resource('javelin-typeahead-dev');
$tokens = array();
$values = nonempty($this->getValue(), array());
foreach ($values as $key => $value) {
$tokens[] = $this->renderToken($key, $value);
}
$name = $this->getName();
$input = javelin_render_tag(
'input',
array(
'mustcapture' => true,
'name' => $name,
'class' => 'jx-tokenizer-input',
'sigil' => 'tokenizer',
'style' => 'width: 0px;',
'disabled' => 'disabled',
'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',
array(
'id' => $id,
'class' => 'jx-tokenizer-container',
),
implode('', $tokens).
$input.
'<div style="clear: both;"></div>');
return phutil_render_tag(
'input',
array(
'type' => 'text',
'name' => $this->getName(),
'value' => $this->getValue(),
'disabled' => $this->getDisabled() ? 'disabled' : null,
));
}
private function renderToken($key, $value) {
$input_name = $this->getName();
if ($input_name) {
$input_name .= '[]';
}
return phutil_render_tag(
'a',
array(
'class' => 'jx-tokenizer-token',
),
phutil_escape_html($value).
phutil_render_tag(
'input',
array(
'type' => 'hidden',
'name' => $input_name,
'value' => $key,
)).
'<span class="jx-tokenizer-x-placeholder"></span>');
}
}
diff --git a/webroot/rsrc/js/application/differential/behavior-add-reviewers.js b/webroot/rsrc/js/application/differential/behavior-add-reviewers.js
new file mode 100644
index 0000000000..43d245bf6a
--- /dev/null
+++ b/webroot/rsrc/js/application/differential/behavior-add-reviewers.js
@@ -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));
+ }
+ });
+});
+

File Metadata

Mime Type
text/x-diff
Expires
Thu, Aug 14, 10:02 PM (2 d, 18 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
202341
Default Alt Text
(39 KB)

Event Timeline