mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
Include added reviewers and ccs in preview
Summary: Preview of Add Reviewers looks silly without actually showing them Test Plan: Go to any diff Leap into action: Add Reviewers Add some reviewers Write some comment Preview including Added reviewers should be displayed Change action to Comment Added reviewers should disappear Repeat with Add CCs Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley, vrana Differential Revision: https://secure.phabricator.com/D1276
This commit is contained in:
parent
4077ef2555
commit
460efc4489
8 changed files with 49 additions and 1870 deletions
2
externals/javelin
vendored
2
externals/javelin
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 713f1fc54f9cfc830acbf6bbdb46a2883f772896
|
||||
Subproject commit f25470da2c98cd37fbac435a56128b1d465f7667
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -30,16 +30,36 @@ class DifferentialCommentPreviewController extends DifferentialController {
|
|||
|
||||
$author_phid = $request->getUser()->getPHID();
|
||||
|
||||
$handles = id(new PhabricatorObjectHandleData(array($author_phid)))
|
||||
->loadHandles();
|
||||
$action = $request->getStr('action');
|
||||
|
||||
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
|
||||
|
||||
$comment = new DifferentialComment();
|
||||
$comment->setContent($request->getStr('content'));
|
||||
$comment->setAction($request->getStr('action'));
|
||||
$comment->setAction($action);
|
||||
$comment->setAuthorPHID($author_phid);
|
||||
|
||||
$handles = array($author_phid);
|
||||
|
||||
$reviewers = $request->getStr('reviewers');
|
||||
if ($action == DifferentialAction::ACTION_ADDREVIEWERS && $reviewers) {
|
||||
$reviewers = explode(',', $reviewers);
|
||||
$comment->setMetadata(array(
|
||||
DifferentialComment::METADATA_ADDED_REVIEWERS => $reviewers));
|
||||
$handles = array_merge($handles, $reviewers);
|
||||
}
|
||||
|
||||
$ccs = $request->getStr('ccs');
|
||||
if ($action == DifferentialAction::ACTION_ADDCCS && $ccs) {
|
||||
$ccs = explode(',', $ccs);
|
||||
$comment->setMetadata(array(
|
||||
DifferentialComment::METADATA_ADDED_CCS => $ccs));
|
||||
$handles = array_merge($handles, $ccs);
|
||||
}
|
||||
|
||||
$handles = id(new PhabricatorObjectHandleData($handles))
|
||||
->loadHandles();
|
||||
|
||||
$view = new DifferentialRevisionCommentView();
|
||||
$view->setUser($request->getUser());
|
||||
$view->setComment($comment);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
|
||||
phutil_require_module('phabricator', 'aphront/response/ajax');
|
||||
phutil_require_module('phabricator', 'applications/differential/constants/action');
|
||||
phutil_require_module('phabricator', 'applications/differential/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/differential/storage/comment');
|
||||
phutil_require_module('phabricator', 'applications/differential/view/revisioncomment');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -200,6 +200,10 @@ final class DifferentialAddCommentView extends AphrontView {
|
|||
'preview' => 'comment-preview',
|
||||
'action' => 'comment-action',
|
||||
'content' => 'comment-content',
|
||||
'previewTokenizers' => array(
|
||||
'reviewers' => 'add-reviewers-tokenizer',
|
||||
'ccs' => 'add-ccs-tokenizer',
|
||||
),
|
||||
|
||||
'inlineuri' => '/differential/comment/inline/preview/'.$rev_id.'/',
|
||||
'inline' => 'inline-comment-preview',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -151,6 +151,7 @@ final class CelerityStaticResourceResponse {
|
|||
|
||||
$higher_priority_names = array(
|
||||
'refresh-csrf',
|
||||
'aphront-basic-tokenizer',
|
||||
);
|
||||
|
||||
$higher_priority_behaviors = array_select_keys(
|
||||
|
|
|
@ -24,6 +24,9 @@ JX.behavior('differential-add-reviewers-and-ccs', function(config) {
|
|||
|
||||
var tokenizer = new JX.Tokenizer(root);
|
||||
tokenizer.setTypeahead(typeahead);
|
||||
|
||||
JX.Stratcom.addData(root, {'tokenizer' : tokenizer});
|
||||
|
||||
tokenizer.start();
|
||||
|
||||
return tokenizer;
|
||||
|
|
|
@ -12,16 +12,25 @@ JX.behavior('differential-feedback-preview', function(config) {
|
|||
|
||||
var action = JX.$(config.action);
|
||||
var content = JX.$(config.content);
|
||||
var previewTokenizers = {};
|
||||
for (var field in config.previewTokenizers) {
|
||||
var tokenizer = JX.$(config.previewTokenizers[field]);
|
||||
previewTokenizers[field] = JX.Stratcom.getData(tokenizer).tokenizer;
|
||||
}
|
||||
|
||||
var callback = function(r) {
|
||||
JX.DOM.setContent(JX.$(config.preview), JX.$H(r));
|
||||
};
|
||||
|
||||
var getdata = function() {
|
||||
return {
|
||||
var data = {
|
||||
content : content.value,
|
||||
action : action.value
|
||||
};
|
||||
for (var field in previewTokenizers) {
|
||||
data[field] = JX.keys(previewTokenizers[field].getTokens()).join(',');
|
||||
}
|
||||
return data;
|
||||
};
|
||||
|
||||
var request = new JX.PhabricatorShapedRequest(config.uri, callback, getdata);
|
||||
|
@ -29,6 +38,9 @@ JX.behavior('differential-feedback-preview', function(config) {
|
|||
|
||||
JX.DOM.listen(content, 'keydown', null, trigger);
|
||||
JX.DOM.listen(action, 'change', null, trigger);
|
||||
for (var field in previewTokenizers) {
|
||||
previewTokenizers[field].listen('change', trigger);
|
||||
}
|
||||
|
||||
request.start();
|
||||
|
||||
|
|
Loading…
Reference in a new issue