@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

InlineComments

+494 -95
+29 -29
src/__celerity_resource_map__.php
··· 9 9 celerity_register_resource_map(array( 10 10 'aphront-dialog-view-css' => 11 11 array( 12 - 'uri' => '/res/d98e6292/rsrc/css/aphront/dialog-view.css', 12 + 'uri' => '/res/a05107ae/rsrc/css/aphront/dialog-view.css', 13 13 'type' => 'css', 14 14 'requires' => 15 15 array( ··· 100 100 ), 101 101 'differential-changeset-view-css' => 102 102 array( 103 - 'uri' => '/res/658d181a/rsrc/css/application/differential/changeset-view.css', 103 + 'uri' => '/res/11e7232a/rsrc/css/application/differential/changeset-view.css', 104 104 'type' => 'css', 105 105 'requires' => 106 106 array( ··· 190 190 ), 191 191 'phabricator-core-dialog-css' => 192 192 array( 193 - 'uri' => '/res/d9580553/rsrc/css/core/dialog.css', 193 + 'uri' => '/res/f66cec41/rsrc/css/core/dialog.css', 194 194 'type' => 'css', 195 195 'requires' => 196 196 array( ··· 237 237 ), 238 238 'javelin-behavior-differential-edit-inline-comments' => 239 239 array( 240 - 'uri' => '/res/51d7da98/rsrc/js/application/differential/behavior-edit-inline-comments.js', 240 + 'uri' => '/res/be5ed33e/rsrc/js/application/differential/behavior-edit-inline-comments.js', 241 241 'type' => 'js', 242 242 'requires' => 243 243 array( ··· 276 276 ), 277 277 'javelin-init-prod' => 278 278 array( 279 - 'uri' => '/res/ce6bff38/rsrc/js/javelin/init.min.js', 279 + 'uri' => '/res/1267c868/rsrc/js/javelin/init.min.js', 280 280 'type' => 'js', 281 281 'requires' => 282 282 array( ··· 285 285 ), 286 286 'javelin-lib-dev' => 287 287 array( 288 - 'uri' => '/res/29c9b6b4/rsrc/js/javelin/javelin.dev.js', 288 + 'uri' => '/res/53784c9a/rsrc/js/javelin/javelin.dev.js', 289 289 'type' => 'js', 290 290 'requires' => 291 291 array( ··· 294 294 ), 295 295 'javelin-lib-prod' => 296 296 array( 297 - 'uri' => '/res/ef13c830/rsrc/js/javelin/javelin.min.js', 297 + 'uri' => '/res/2f2b3b2e/rsrc/js/javelin/javelin.min.js', 298 298 'type' => 'js', 299 299 'requires' => 300 300 array( ··· 312 312 ), 313 313 'javelin-typeahead-prod' => 314 314 array( 315 - 'uri' => '/res/593d9bb8/rsrc/js/javelin/typeahead.min.js', 315 + 'uri' => '/res/69d5fad1/rsrc/js/javelin/typeahead.min.js', 316 316 'type' => 'js', 317 317 'requires' => 318 318 array( ··· 321 321 ), 322 322 'javelin-workflow-dev' => 323 323 array( 324 - 'uri' => '/res/2d740661/rsrc/js/javelin/workflow.dev.js', 324 + 'uri' => '/res/7e690e16/rsrc/js/javelin/workflow.dev.js', 325 325 'type' => 'js', 326 326 'requires' => 327 327 array( ··· 340 340 ), array ( 341 341 'packages' => 342 342 array ( 343 - 'dc2390af' => 343 + '4bb7e37f' => 344 344 array ( 345 345 'name' => 'core.pkg.css', 346 346 'symbols' => ··· 357 357 9 => 'aphront-typeahead-control-css', 358 358 10 => 'phabricator-directory-css', 359 359 ), 360 - 'uri' => '/res/pkg/dc2390af/core.pkg.css', 360 + 'uri' => '/res/pkg/4bb7e37f/core.pkg.css', 361 361 'type' => 'css', 362 362 ), 363 - '69b11588' => 363 + 'f399aad7' => 364 364 array ( 365 365 'name' => 'differential.pkg.css', 366 366 'symbols' => ··· 371 371 3 => 'differential-revision-history-css', 372 372 4 => 'differential-table-of-contents-css', 373 373 ), 374 - 'uri' => '/res/pkg/69b11588/differential.pkg.css', 374 + 'uri' => '/res/pkg/f399aad7/differential.pkg.css', 375 375 'type' => 'css', 376 376 ), 377 377 ), 378 378 'reverse' => 379 379 array ( 380 - 'phabricator-core-css' => 'dc2390af', 381 - 'phabricator-core-buttons-css' => 'dc2390af', 382 - 'phabricator-standard-page-view' => 'dc2390af', 383 - 'aphront-dialog-view-css' => 'dc2390af', 384 - 'aphront-form-view-css' => 'dc2390af', 385 - 'aphront-panel-view-css' => 'dc2390af', 386 - 'aphront-side-nav-view-css' => 'dc2390af', 387 - 'aphront-table-view-css' => 'dc2390af', 388 - 'aphront-tokenizer-control-css' => 'dc2390af', 389 - 'aphront-typeahead-control-css' => 'dc2390af', 390 - 'phabricator-directory-css' => 'dc2390af', 391 - 'differential-core-view-css' => '69b11588', 392 - 'differential-changeset-view-css' => '69b11588', 393 - 'differential-revision-detail-css' => '69b11588', 394 - 'differential-revision-history-css' => '69b11588', 395 - 'differential-table-of-contents-css' => '69b11588', 380 + 'phabricator-core-css' => '4bb7e37f', 381 + 'phabricator-core-buttons-css' => '4bb7e37f', 382 + 'phabricator-standard-page-view' => '4bb7e37f', 383 + 'aphront-dialog-view-css' => '4bb7e37f', 384 + 'aphront-form-view-css' => '4bb7e37f', 385 + 'aphront-panel-view-css' => '4bb7e37f', 386 + 'aphront-side-nav-view-css' => '4bb7e37f', 387 + 'aphront-table-view-css' => '4bb7e37f', 388 + 'aphront-tokenizer-control-css' => '4bb7e37f', 389 + 'aphront-typeahead-control-css' => '4bb7e37f', 390 + 'phabricator-directory-css' => '4bb7e37f', 391 + 'differential-core-view-css' => 'f399aad7', 392 + 'differential-changeset-view-css' => 'f399aad7', 393 + 'differential-revision-detail-css' => 'f399aad7', 394 + 'differential-revision-history-css' => 'f399aad7', 395 + 'differential-table-of-contents-css' => 'f399aad7', 396 396 ), 397 397 ));
+4
src/__phutil_library_map__.php
··· 91 91 'DifferentialDiffViewController' => 'applications/differential/controller/diffview', 92 92 'DifferentialHunk' => 'applications/differential/storage/hunk', 93 93 'DifferentialInlineComment' => 'applications/differential/storage/inlinecomment', 94 + 'DifferentialInlineCommentEditController' => 'applications/differential/controller/inlinecommentedit', 95 + 'DifferentialInlineCommentView' => 'applications/differential/view/inlinecomment', 94 96 'DifferentialLintStatus' => 'applications/differential/constants/lintstatus', 95 97 'DifferentialMail' => 'applications/differential/mail/base', 96 98 'DifferentialMarkupEngineFactory' => 'applications/differential/parser/markup', ··· 266 268 'DifferentialDiffViewController' => 'DifferentialController', 267 269 'DifferentialHunk' => 'DifferentialDAO', 268 270 'DifferentialInlineComment' => 'DifferentialDAO', 271 + 'DifferentialInlineCommentEditController' => 'DifferentialController', 272 + 'DifferentialInlineCommentView' => 'AphrontView', 269 273 'DifferentialNewDiffMail' => 'DifferentialReviewRequestMail', 270 274 'DifferentialReviewRequestMail' => 'DifferentialMail', 271 275 'DifferentialRevision' => 'DifferentialDAO',
+6 -1
src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php
··· 91 91 'save/$' => 'DifferentialCommentSaveController', 92 92 'inline/' => array( 93 93 'preview/$' => 'DifferentialInlineCommentPreviewController', 94 - 'edit/$' => 'DifferentialInlineCommentEditController', 94 + 'edit/(?<id>\d+)/$' => 'DifferentialInlineCommentEditController', 95 95 ), 96 96 ), 97 97 ), ··· 166 166 $response = new AphrontWebpageResponse(); 167 167 $response->setContent($view->render()); 168 168 return $response; 169 + } else { 170 + return id(new AphrontAjaxResponse()) 171 + ->setContent(array( 172 + 'dialog' => $response->buildResponseString(), 173 + )); 169 174 } 170 175 } else if ($response instanceof Aphront404Response) { 171 176
+2
src/aphront/default/configuration/__init__.php
··· 8 8 9 9 phutil_require_module('phabricator', 'aphront/applicationconfiguration'); 10 10 phutil_require_module('phabricator', 'aphront/request'); 11 + phutil_require_module('phabricator', 'aphront/response/ajax'); 11 12 phutil_require_module('phabricator', 'aphront/response/webpage'); 12 13 phutil_require_module('phabricator', 'applications/base/controller/404'); 13 14 phutil_require_module('phabricator', 'view/page/failure'); 14 15 phutil_require_module('phabricator', 'view/page/standard'); 15 16 16 17 phutil_require_module('phutil', 'markup'); 18 + phutil_require_module('phutil', 'utils'); 17 19 18 20 19 21 phutil_require_source('AphrontDefaultApplicationConfiguration.php');
+25
src/applications/differential/controller/changesetview/DifferentialChangesetViewController.php
··· 23 23 $request = $this->getRequest(); 24 24 25 25 $id = $request->getStr('id'); 26 + $author_phid = $request->getUser()->getPHID(); 26 27 27 28 $changeset = id(new DifferentialChangeset())->load($id); 28 29 if (!$changeset) { ··· 53 54 54 55 $parser = new DifferentialChangesetParser(); 55 56 $parser->setChangeset($changeset); 57 + 58 + $phids = array(); 59 + $inlines = $this->loadInlineComments($id, $author_phid); 60 + foreach ($inlines as $inline) { 61 + $parser->parseInlineComment($inline); 62 + $phids[$inline->getAuthorPHID()] = true; 63 + } 64 + $phids = array_keys($phids); 65 + 66 + $handles = id(new PhabricatorObjectHandleData($phids)) 67 + ->loadHandles(); 68 + $parser->setHandles($handles); 69 + 70 + $factory = new DifferentialMarkupEngineFactory(); 71 + $engine = $factory->newDifferentialCommentMarkupEngine(); 72 + $parser->setMarkupEngine($engine); 56 73 57 74 $output = $parser->render(null, $range_s, $range_e, $mask); 58 75 ··· 84 101 'title' => 'Changeset View', 85 102 )); 86 103 } 104 + 105 + private function loadInlineComments($changeset_id, $author_phid) { 106 + return id(new DifferentialInlineComment())->loadAllWhere( 107 + 'changesetID = %d AND (commentID IS NOT NULL OR authorPHID = %s)', 108 + $changeset_id, 109 + $author_phid); 110 + } 111 + 87 112 88 113 }
+116
src/applications/differential/controller/inlinecommentedit/DifferentialInlineCommentEditController.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2011 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + class DifferentialInlineCommentEditController extends DifferentialController { 20 + 21 + private $revisionID; 22 + 23 + public function willProcessRequest(array $data) { 24 + $this->revisionID = $data['id']; 25 + } 26 + 27 + public function processRequest() { 28 + $request = $this->getRequest(); 29 + 30 + $changeset = $request->getInt('changeset'); 31 + $is_new = $request->getInt('is_new'); 32 + $on_right = $request->getInt('on_right'); 33 + $number = $request->getInt('number'); 34 + $length = $request->getInt('length'); 35 + $text = $request->getStr('text'); 36 + $op = $request->getStr('op'); 37 + 38 + $user = $request->getUser(); 39 + 40 + $submit_uri = '/differential/comment/inline/edit/'.$this->revisionID.'/'; 41 + 42 + switch ($op) { 43 + case 'delete': 44 + if ($request->isFormPost()) { 45 + // do the delete; 46 + return new AphrontAjaxResponse(); 47 + } 48 + 49 + $dialog = new AphrontDialogView(); 50 + $dialog->setTitle('Really delete this comment?'); 51 + 52 + return id(new AphrontDialogResponse())->setDialog($dialog); 53 + case 'edit': 54 + $dialog = new AphrontDialogView(); 55 + 56 + return id(new AphrontDialogResponse())->setDialog($dialog); 57 + case 'create': 58 + 59 + if (!$request->isFormPost() || !strlen($text)) { 60 + return new AphrontAjaxResponse(); 61 + } 62 + 63 + $factory = new DifferentialMarkupEngineFactory(); 64 + $engine = $factory->newDifferentialCommentMarkupEngine(); 65 + 66 + $phids = array($user->getPHID()); 67 + 68 + $handles = id(new PhabricatorObjectHandleData($phids)) 69 + ->loadHandles(); 70 + 71 + $inline = id(new DifferentialInlineComment()) 72 + ->setRevisionID($this->revisionID) 73 + ->setChangesetID($changeset) 74 + ->setCommentID(null) 75 + ->setAuthorPHID($user->getPHID()) 76 + ->setLineNumber($number) 77 + ->setLineLength($length) 78 + ->setIsNewFile($is_new) 79 + ->setContent($text) 80 + ->save(); 81 + 82 + $view = new DifferentialInlineCommentView(); 83 + $view->setInlineComment($inline); 84 + $view->setOnRight($on_right); 85 + $view->setBuildScaffolding(true); 86 + $view->setMarkupEngine($engine); 87 + $view->setHandles($handles); 88 + 89 + return id(new AphrontAjaxResponse()) 90 + ->setContent( 91 + array( 92 + 'inlineCommentID' => $inline->getID(), 93 + 'markup' => $view->render(), 94 + )); 95 + default: 96 + $dialog = new AphrontDialogView(); 97 + $dialog->setUser($user); 98 + $dialog->setTitle('New Inline Comment'); 99 + $dialog->setSubmitURI($submit_uri); 100 + 101 + $dialog->addHiddenInput('op', 'create'); 102 + $dialog->addHiddenInput('changeset', $changeset); 103 + $dialog->addHiddenInput('is_new', $is_new); 104 + $dialog->addHiddenInput('on_right', $on_right); 105 + $dialog->addHiddenInput('number', $number); 106 + $dialog->addHiddenInput('length', $length); 107 + 108 + $dialog->addSubmitButton(); 109 + $dialog->addCancelButton('#'); 110 + $dialog->appendChild('<textarea name="text"></textarea>'); 111 + 112 + return id(new AphrontDialogResponse())->setDialog($dialog); 113 + } 114 + } 115 + 116 + }
+19
src/applications/differential/controller/inlinecommentedit/__init__.php
··· 1 + <?php 2 + /** 3 + * This file is automatically generated. Lint this module to rebuild it. 4 + * @generated 5 + */ 6 + 7 + 8 + 9 + phutil_require_module('phabricator', 'aphront/response/ajax'); 10 + phutil_require_module('phabricator', 'aphront/response/dialog'); 11 + phutil_require_module('phabricator', 'applications/differential/controller/base'); 12 + phutil_require_module('phabricator', 'applications/differential/storage/inlinecomment'); 13 + phutil_require_module('phabricator', 'applications/differential/view/inlinecomment'); 14 + phutil_require_module('phabricator', 'view/dialog'); 15 + 16 + phutil_require_module('phutil', 'utils'); 17 + 18 + 19 + phutil_require_source('DifferentialInlineCommentEditController.php');
+31 -29
src/applications/differential/parser/changeset/DifferentialChangesetParser.php
··· 41 41 protected $subparser; 42 42 protected $oldChangesetID = null; 43 43 protected $noHighlight; 44 + 45 + private $handles; 44 46 45 47 const CACHE_VERSION = 4; 46 48 ··· 89 91 if (strpos($filename, '.', 1) !== false) { 90 92 $this->filetype = end(explode('.', $filename)); 91 93 } 94 + } 95 + 96 + public function setHandles(array $handles) { 97 + $this->handles = $handles; 98 + return $this; 99 + } 100 + 101 + public function setMarkupEngine(PhutilMarkupEngine $engine) { 102 + $this->markupEngine = $engine; 103 + return $this; 92 104 } 93 105 94 106 public function parseHunk(DifferentialHunk $hunk) { ··· 773 785 $new_mask = array(); 774 786 $feedback_mask = array(); 775 787 776 - $handles = array(); 777 788 if ($this->comments) { 778 789 foreach ($this->comments as $comment) { 779 790 $start = max($comment->getLineNumber() - self::LINES_CONTEXT, 0); 780 - $end = $comment->getFinalLine() + self::LINES_CONTEXT; 791 + $end = $comment->getLineNumber() + 792 + $comment->getLineLength() + 793 + self::LINES_CONTEXT; 781 794 $new = $this->isCommentInNewFile($comment); 782 795 for ($ii = $start; $ii <= $end; $ii++) { 783 796 if ($new) { ··· 799 812 $feedback_mask[$ii] = true; 800 813 } 801 814 } 802 - /* 803 - $handle_ids = mpull($this->comments, 'getUserPHID'); 804 - $handles = array(); 805 - $handle_data = new ToolsHandleData($handle_ids, $handles); 806 - $handle_data->needNames(); 807 - prep($handle_data); 808 - 809 815 $this->comments = msort($this->comments, 'getID'); 810 816 foreach ($this->comments as $comment) { 817 + $final = $comment->getLineNumber() + 818 + $comment->getLineLength(); 811 819 if ($this->isCommentInNewFile($comment)) { 812 - $new_comments[$comment->getFinalLine()][] = $comment; 820 + $new_comments[$final][] = $comment; 813 821 } else { 814 - $old_comments[$comment->getFinalLine()][] = $comment; 822 + $old_comments[$final][] = $comment; 815 823 } 816 824 } 817 - */ 818 825 } 819 826 820 827 $html = $this->renderTextChange( ··· 823 830 $mask_force, 824 831 $feedback_mask, 825 832 $viewer_context, 826 - $handles, 827 833 $old_comments, 828 834 $new_comments); 829 835 ··· 879 885 $mask_force, 880 886 $feedback_mask, 881 887 $viewer_context, 882 - $handles, 883 888 array $old_comments, 884 889 array $new_comments) { 885 890 ··· 1080 1085 foreach ($old_comments[$o_num] as $comment) { 1081 1086 $xhp = $this->renderInlineComment( 1082 1087 $comment, 1083 - $viewer_context, 1084 - $handles); 1088 + $viewer_context); 1085 1089 $html[] = 1086 1090 '<tr class="inline"><th /><td>'. 1087 1091 $xhp. ··· 1092 1096 foreach ($new_comments[$n_num] as $comment) { 1093 1097 $xhp = $this->renderInlineComment( 1094 1098 $comment, 1095 - $viewer_context, 1096 - $handles); 1099 + $viewer_context); 1097 1100 $html[] = 1098 1101 '<tr class="inline"><th /><td /><th /><td>'. 1099 1102 $xhp. ··· 1107 1110 1108 1111 private function renderInlineComment( 1109 1112 DifferentialInlineComment $comment, 1110 - $viewer_context, 1111 - $handles) { 1113 + $viewer_context) { 1112 1114 1113 1115 $edit = $viewer_context && 1114 - ($comment->getUserPHID() == $viewer_context->getUserID()) && 1116 + ($comment->getAuthorPHID() == $viewer_context->getUserID()) && 1115 1117 (!$comment->getFeedbackID()); 1116 1118 1117 1119 $is_new = $this->isCommentInNewFile($comment); 1118 1120 1119 - return ''; 1120 - /* 1121 - return <differential:inline-comment 1122 - inline={$comment} 1123 - edit={$edit} 1124 - isnew={$is_new} 1125 - handle={$handles[$comment->getUserPHID()]} />; 1126 - */ 1121 + return id(new DifferentialInlineCommentView()) 1122 + ->setInlineComment($comment) 1123 + ->setOnRight($is_new) 1124 + ->setHandles($this->handles) 1125 + ->setMarkupEngine($this->markupEngine) 1126 + ->render(); 1127 1127 } 1128 1128 1129 1129 protected function renderPropertyChangeHeader($changeset) { ··· 1146 1146 1147 1147 return null; 1148 1148 /* 1149 + TODO 1150 + 1149 1151 $table = <table class="differential-property-table" />; 1150 1152 $table->appendChild( 1151 1153 <tr class="property-table-header">
+4
src/applications/differential/view/changesetdetailview/DifferentialChangesetDetailView.php
··· 48 48 'div', 49 49 array( 50 50 'sigil' => 'differential-changeset', 51 + 'meta' => array( 52 + 'left' => $this->changeset->getID(), 53 + 'right' => $this->changeset->getID(), 54 + ), 51 55 'class' => $class, 52 56 ), 53 57 '<a name="#'."TODO".'"></a>'.
+1 -1
src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php
··· 121 121 if ($this->editable) { 122 122 $revision = $this->revision; 123 123 Javelin::initBehavior('differential-edit-inline-comments', array( 124 - 'uri' => '/differential/inline/edit/'.$revision->getID().'/', 124 + 'uri' => '/differential/comment/inline/edit/'.$revision->getID().'/', 125 125 )); 126 126 } 127 127
+131
src/applications/differential/view/inlinecomment/DifferentialInlineCommentView.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2011 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + final class DifferentialInlineCommentView extends AphrontView { 20 + 21 + private $inlineComment; 22 + private $onRight; 23 + private $buildScaffolding; 24 + private $handles; 25 + private $markupEngine; 26 + 27 + public function setInlineComment(DifferentialInlineComment $comment) { 28 + $this->inlineComment = $comment; 29 + return $this; 30 + } 31 + 32 + public function setOnRight($on_right) { 33 + $this->onRight = $on_right; 34 + return $this; 35 + } 36 + 37 + public function setBuildScaffolding($scaffold) { 38 + $this->buildScaffolding = $scaffold; 39 + return $this; 40 + } 41 + 42 + public function setHandles(array $handles) { 43 + $this->handles = $handles; 44 + return $this; 45 + } 46 + 47 + public function setMarkupEngine(PhutilMarkupEngine $engine) { 48 + $this->markupEngine = $engine; 49 + return $this; 50 + } 51 + 52 + public function render() { 53 + 54 + $inline = $this->inlineComment; 55 + 56 + $start = $inline->getLineNumber(); 57 + $length = $inline->getLineLength(); 58 + if ($length) { 59 + $end = $start + $length; 60 + $line = 'Lines '.number_format($start).'-'.number_format($end); 61 + } else { 62 + $line = 'Line '.number_format($start); 63 + } 64 + 65 + $metadata = array( 66 + 'number' => $inline->getLineNumber(), 67 + 'length' => $inline->getLineLength(), 68 + 'on_right' => $this->onRight, // TODO 69 + ); 70 + 71 + $sigil = 'differential-inline-comment'; 72 + 73 + $links = 'xxx'; 74 + $content = $inline->getContent(); 75 + $handles = $this->handles; 76 + 77 + if ($links) { 78 + $links = 79 + '<span class="differential-inline-comment-links">'. 80 + $links. 81 + '</span>'; 82 + } 83 + 84 + $content = $this->markupEngine->markupText($content); 85 + 86 + $markup = javelin_render_tag( 87 + 'div', 88 + array( 89 + 'class' => 'differential-inline-comment', 90 + 'sigil' => $sigil, 91 + 'meta' => $metadata, 92 + ), 93 + '<div class="differential-inline-comment-head">'. 94 + $links. 95 + '<span class="differential-inline-comment-line">'.$line.'</span>'. 96 + $handles[$inline->getAuthorPHID()]->renderLink(). 97 + '</div>'. 98 + $content); 99 + 100 + return $this->scaffoldMarkup($markup); 101 + } 102 + 103 + private function scaffoldMarkup($markup) { 104 + if (!$this->buildScaffolding) { 105 + return $markup; 106 + } 107 + 108 + if ($this->onRight) { 109 + return 110 + '<table>'. 111 + '<tr>'. 112 + '<th></th>'. 113 + '<td></td>'. 114 + '<th></th>'. 115 + '<td>'.$markup.'</td>'. 116 + '</tr>'. 117 + '</table>'; 118 + } else { 119 + return 120 + '<table>'. 121 + '<tr>'. 122 + '<th></th>'. 123 + '<td>'.$markup.'</td>'. 124 + '<th></th>'. 125 + '<td></td>'. 126 + '</tr>'. 127 + '</table>'; 128 + } 129 + } 130 + 131 + }
+12
src/applications/differential/view/inlinecomment/__init__.php
··· 1 + <?php 2 + /** 3 + * This file is automatically generated. Lint this module to rebuild it. 4 + * @generated 5 + */ 6 + 7 + 8 + 9 + phutil_require_module('phabricator', 'view/base'); 10 + 11 + 12 + phutil_require_source('DifferentialInlineCommentView.php');
+8 -6
src/storage/lisk/dao/LiskDAO.php
··· 718 718 $map[$key] = qsprintf($conn, '%C = %ns', $key, $value); 719 719 } 720 720 $map = implode(', ', $map); 721 - 721 + 722 722 if ($use_locks) { 723 723 $conn->query( 724 724 'UPDATE %T SET %Q, version = version + 1 WHERE %C = %d AND %C = %d', ··· 811 811 812 812 $this->willWriteData($data); 813 813 814 + $conn = $this->getConnection('w'); 815 + 814 816 $columns = array_keys($data); 815 - foreach ($columns as $k => $property) { 816 - $columns[$k] = $property; 817 + 818 + foreach ($data as $key => $value) { 819 + $data[$key] = qsprintf($conn, '%ns', $value); 817 820 } 818 - 819 - $conn = $this->getConnection('w'); 821 + $data = implode(', ', $data); 820 822 821 823 $conn->query( 822 - '%Q INTO %T (%LC) VALUES (%Ls)', 824 + '%Q INTO %T (%LC) VALUES (%Q)', 823 825 $mode, 824 826 $this->getTableName(), 825 827 $columns,
+35 -1
src/view/dialog/AphrontDialogView.php
··· 22 22 private $submitButton; 23 23 private $cancelURI; 24 24 private $submitURI; 25 + private $user; 26 + private $hidden = array(); 27 + 28 + public function setUser(PhabricatorUser $user) { 29 + $this->user = $user; 30 + return $this; 31 + } 25 32 26 33 public function setSubmitURI($uri) { 27 34 $this->submitURI = $uri; ··· 47 54 return $this; 48 55 } 49 56 57 + public function addHiddenInput($key, $value) { 58 + $this->hidden[$key] = $value; 59 + return $this; 60 + } 61 + 50 62 final public function render() { 51 63 require_celerity_resource('aphront-dialog-view-css'); 52 64 ··· 59 71 } 60 72 61 73 if ($this->cancelURI) { 62 - $buttons[] = phutil_render_tag( 74 + $buttons[] = javelin_render_tag( 63 75 'a', 64 76 array( 65 77 'href' => $this->cancelURI, 66 78 'class' => 'button grey', 79 + 'name' => '__cancel__', 80 + 'sigil' => 'jx-workflow-button', 67 81 ), 68 82 'Cancel'); 69 83 } 70 84 85 + if (!$this->user) { 86 + throw new Exception( 87 + "You must call setUser() when rendering an AphrontDialogView."); 88 + } 89 + $csrf = $this->user->getCSRFToken(); 90 + 91 + $hidden_inputs = array(); 92 + foreach ($this->hidden as $key => $value) { 93 + $hidden_inputs[] = phutil_render_tag( 94 + 'input', 95 + array( 96 + 'type' => 'hidden', 97 + 'name' => $key, 98 + 'value' => $value, 99 + )); 100 + } 101 + $hidden_inputs = implode("\n", $hidden_inputs); 102 + 71 103 return javelin_render_tag( 72 104 'form', 73 105 array( ··· 77 109 'sigil' => 'jx-dialog', 78 110 ), 79 111 '<input type="hidden" name="__form__" value="1" />'. 112 + '<input type="hidden" name="__csrf__" value="'.$csrf.'" />'. 113 + $hidden_inputs. 80 114 '<div class="aphront-dialog-head">'. 81 115 phutil_escape_html($this->title). 82 116 '</div>'.
+34
webroot/rsrc/css/application/differential/changeset-view.css
··· 130 130 left: 0px; 131 131 } 132 132 133 + .differential-inline-comment { 134 + background: #f9f9f1; 135 + border: 1px solid #aaaa88; 136 + font-family: Verdana; 137 + font-size: 11px; 138 + margin: 4px 0px; 139 + max-width: 81ch; 140 + padding: 8px 10px; 141 + width: 100%; 142 + -moz-box-sizing: border-box; 143 + -webkit-box-sizing: border-box; 144 + } 145 + 146 + .differential-inline-comment-head { 147 + font-weight: bold; 148 + color: #333333; 149 + border-bottom: 1px solid #ccccaa; 150 + padding-bottom: 6px; 151 + margin-bottom: 4px; 152 + } 153 + 154 + .differential-inline-comment-links, 155 + .differential-inline-comment-line { 156 + font-weight: normal; 157 + font-style: italic; 158 + color: #666666; 159 + float: right; 160 + white-space: nowrap; 161 + } 162 + 163 + .differential-inline-comment-edit { 164 + padding-left: 8px; 165 + font-style: normal; 166 + }
+28 -22
webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js
··· 53 53 finishSelect(); 54 54 } 55 55 56 + function isOnRight(node) { 57 + return node.parentNode.firstChild != node; 58 + } 59 + 56 60 function isNewFile(node) { 57 - return node.parentNode.firstChild != node; 61 + var data = JX.Stratcom.getData(root); 62 + return isOnRight(node) || (data.left != data.right); 58 63 } 59 64 60 65 function getRowNumber(th_node) { ··· 81 86 origin = target = e.getTarget(); 82 87 83 88 var data = e.getNodeData('differential-changeset'); 84 - if (isNewFile(target)) { 85 - changeset = data.oid; 89 + if (isOnRight(target)) { 90 + changeset = data.left; 86 91 } else { 87 - changeset = data.nid; 92 + changeset = data.right; 88 93 } 89 94 90 95 updateReticle(); ··· 99 104 if (!selecting || 100 105 workflow || 101 106 (getRowNumber(e.getTarget()) === undefined) || 102 - (isNewFile(e.getTarget()) != isNewFile(origin)) || 107 + (isOnRight(e.getTarget()) != isOnRight(origin)) || 103 108 (e.getNode('differential-changeset') !== root)) { 104 109 return; 105 110 } ··· 136 141 changeset: changeset, 137 142 number: o, 138 143 length: len, 139 - is_new: isNewFile(target) ? 1 : 0 144 + is_new: isNewFile(target) ? 1 : 0, 145 + on_right: isOnRight(target) ? 1 : 0 140 146 }; 141 147 142 148 workflow = true; ··· 155 161 } 156 162 drawInlineComment(insert.parentNode, target, r); 157 163 finishSelect(); 158 - JX.Stratcom.invoke('inline-comment-update', 159 - null, 160 - {id : r.inlineCommentID}); 164 + JX.Stratcom.invoke('differential-inline-comment-update'); 161 165 }) 162 166 .setCloseHandler(finishSelect); 163 167 ··· 175 179 176 180 JX.Stratcom.listen( 177 181 ['mouseover', 'mouseout'], 178 - 'inline-comment', 182 + 'differential-inline-comment', 179 183 function(e) { 180 184 if (selecting || workflow) { 181 185 return; ··· 184 188 if (e.getType() == 'mouseout') { 185 189 hideReticle(); 186 190 } else { 187 - var data = e.getNodeData('inline-comment'); 188 - var change = e.getNodeData('differential-changeset'); 189 - 190 191 root = e.getNode('differential-changeset'); 191 192 192 - var prefix = 'C' + change; 193 + var data = e.getNodeData('differential-inline-comment'); 194 + var change = e.getNodeData('differential-changeset'); 193 195 194 - if (data.is_new) { 195 - prefix += 'NL'; 196 + var prefix; 197 + if (data.on_right) { 198 + prefix = 'C' + (change.left) + 'NL'; 196 199 } else { 197 - prefix += 'OL'; 200 + prefix = 'C' + (change.right) + 'OL'; 198 201 } 199 202 200 203 origin = JX.$(prefix + data.number); 201 - target = JX.$(prefix + (data.number + data.length)); 204 + target = JX.$(prefix + (parseInt(data.number, 10) + 205 + parseInt(data.length, 10))); 202 206 203 207 updateReticle(); 204 208 } ··· 206 210 207 211 JX.Stratcom.listen( 208 212 'click', 209 - [['inline-comment', 'delete'], 210 - ['inline-comment', 'edit']], 213 + [['differential-inline-comment', 'delete'], 214 + ['differential-inline-comment', 'edit']], 211 215 function(e) { 212 216 var data = { 213 217 op: e.getNode('edit') ? 'edit' : 'delete', 214 - id: e.getNodeData('inline-comment').id 218 + id: e.getNodeData('differential-inline-comment').id 215 219 }; 216 220 new JX.Workflow(config.uri, data) 217 221 .setHandler(function(r) { 218 - var base_row = e.getNode('inline-comment').parentNode.parentNode; 222 + var base_row = e.getNode('differential-inline-comment') 223 + .parentNode 224 + .parentNode; 219 225 if (data.op == 'edit' && r.markup) { 220 226 drawInlineComment(base_row.parentNode, base_row, r); 221 227 }
+7 -5
webroot/rsrc/js/javelin/javelin.dev.js
··· 2684 2684 * @task stratcom 2685 2685 * @param Node The node to listen for events underneath. 2686 2686 * @param string|list One or more event types to listen for. 2687 - * @param list? A path to listen on. 2687 + * @param list? A path to listen on, or a list of paths. 2688 2688 * @param function Callback to invoke when a matching event occurs. 2689 2689 * @return object A reference to the installed listener. You can later 2690 2690 * remove the listener by calling this object's remove() 2691 2691 * method. 2692 2692 */ 2693 2693 listen : function(node, type, path, callback) { 2694 - return JX.Stratcom.listen( 2695 - type, 2696 - ['id:'+JX.DOM.uniqID(node)].concat(JX.$AX(path || [])), 2697 - callback); 2694 + var id = ['id:' + JX.DOM.uniqID(node)]; 2695 + path = JX.$AX(path || []); 2696 + for (var ii = 0; ii < path.length; ii++) { 2697 + path[ii] = id.concat(JX.$AX(path[ii])); 2698 + } 2699 + return JX.Stratcom.listen(type, path, callback); 2698 2700 }, 2699 2701 2700 2702 uniqID : function(node) {
+2 -1
webroot/rsrc/js/javelin/workflow.dev.js
··· 111 111 if (JX.Workflow._disabled) { 112 112 return; 113 113 } 114 + 114 115 var t = event.getTarget(); 115 116 if (t.name == '__cancel__' || t.name == '__close__') { 116 117 JX.Workflow._pop(); ··· 152 153 JX.DOM.listen( 153 154 this._root, 154 155 'click', 155 - 'tag:button', 156 + [['jx-workflow-button'], ['tag:button']], 156 157 JX.Workflow._onbutton); 157 158 document.body.appendChild(this._root); 158 159 var d = JX.$V.getDim(this._root);