@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.

Improve behavior of inline rendering with unified views

Summary:
Ref T2009. This reduces how buggy inlines are. They're still buggy.

Specifically, the inline endpoint didn't know how to scaffold inlines before, so some of them ended up rendering in the wrong rows or breaking layouts.

This passes the current renderer through to the inline editor endpoint, so it can at least get the layout correct.

Test Plan: Interacted with inlines in unified and side-by-side views.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2009

Differential Revision: https://secure.phabricator.com/D11988

+117 -56
+21 -21
resources/celerity/map.php
··· 11 11 'core.pkg.js' => 'a77025a1', 12 12 'darkconsole.pkg.js' => '8ab24e01', 13 13 'differential.pkg.css' => '6641cdd5', 14 - 'differential.pkg.js' => 'e260829c', 14 + 'differential.pkg.js' => '3fab5259', 15 15 'diffusion.pkg.css' => '591664fa', 16 16 'diffusion.pkg.js' => 'bfc0737b', 17 17 'maniphest.pkg.css' => '68d4dd3d', ··· 361 361 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375', 362 362 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63', 363 363 'rsrc/js/application/differential/ChangesetViewManager.js' => 'fce415a0', 364 - 'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => '6a049cf7', 364 + 'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => '41060c54', 365 365 'rsrc/js/application/differential/behavior-add-reviewers-and-ccs.js' => 'e10f8e18', 366 366 'rsrc/js/application/differential/behavior-comment-jump.js' => '4fdb476d', 367 367 'rsrc/js/application/differential/behavior-comment-preview.js' => '6932def3', 368 368 'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1', 369 369 'rsrc/js/application/differential/behavior-dropdown-menus.js' => '2035b9cb', 370 - 'rsrc/js/application/differential/behavior-edit-inline-comments.js' => 'f159658c', 370 + 'rsrc/js/application/differential/behavior-edit-inline-comments.js' => 'ae8e9b44', 371 371 'rsrc/js/application/differential/behavior-keyboard-nav.js' => '2c426492', 372 372 'rsrc/js/application/differential/behavior-populate.js' => '8694b1df', 373 373 'rsrc/js/application/differential/behavior-show-field-details.js' => 'bba9eedf', ··· 520 520 'conpherence-widget-pane-css' => '3d575438', 521 521 'differential-changeset-view-css' => 'bad09138', 522 522 'differential-core-view-css' => '7ac3cabc', 523 - 'differential-inline-comment-editor' => '6a049cf7', 523 + 'differential-inline-comment-editor' => '41060c54', 524 524 'differential-results-table-css' => '181aa9d9', 525 525 'differential-revision-add-comment-css' => 'c478bcaa', 526 526 'differential-revision-comment-css' => '48186045', ··· 569 569 'javelin-behavior-differential-comment-jump' => '4fdb476d', 570 570 'javelin-behavior-differential-diff-radios' => 'e1ff79b1', 571 571 'javelin-behavior-differential-dropdown-menus' => '2035b9cb', 572 - 'javelin-behavior-differential-edit-inline-comments' => 'f159658c', 572 + 'javelin-behavior-differential-edit-inline-comments' => 'ae8e9b44', 573 573 'javelin-behavior-differential-feedback-preview' => '6932def3', 574 574 'javelin-behavior-differential-keyboard-navigation' => '2c426492', 575 575 'javelin-behavior-differential-populate' => '8694b1df', ··· 1065 1065 'phuix-action-list-view', 1066 1066 'phuix-action-view', 1067 1067 ), 1068 + '41060c54' => array( 1069 + 'javelin-dom', 1070 + 'javelin-util', 1071 + 'javelin-stratcom', 1072 + 'javelin-install', 1073 + 'javelin-request', 1074 + 'javelin-workflow', 1075 + ), 1068 1076 42126667 => array( 1069 1077 'javelin-behavior', 1070 1078 'javelin-dom', ··· 1238 1246 '69adf288' => array( 1239 1247 'javelin-install', 1240 1248 ), 1241 - '6a049cf7' => array( 1242 - 'javelin-dom', 1243 - 'javelin-util', 1244 - 'javelin-stratcom', 1245 - 'javelin-install', 1246 - 'javelin-request', 1247 - 'javelin-workflow', 1248 - ), 1249 1249 '6c2b09a2' => array( 1250 1250 'javelin-install', 1251 1251 'javelin-util', ··· 1644 1644 'javelin-util', 1645 1645 'phabricator-prefab', 1646 1646 ), 1647 + 'ae8e9b44' => array( 1648 + 'javelin-behavior', 1649 + 'javelin-stratcom', 1650 + 'javelin-dom', 1651 + 'javelin-util', 1652 + 'javelin-vector', 1653 + 'differential-inline-comment-editor', 1654 + ), 1647 1655 'b1f0ccee' => array( 1648 1656 'javelin-install', 1649 1657 'javelin-dom', ··· 1873 1881 'efe49472' => array( 1874 1882 'javelin-install', 1875 1883 'javelin-util', 1876 - ), 1877 - 'f159658c' => array( 1878 - 'javelin-behavior', 1879 - 'javelin-stratcom', 1880 - 'javelin-dom', 1881 - 'javelin-util', 1882 - 'javelin-vector', 1883 - 'differential-inline-comment-editor', 1884 1884 ), 1885 1885 'f24f3253' => array( 1886 1886 'javelin-behavior',
+26 -5
src/applications/differential/view/DifferentialInlineCommentEditView.php
··· 8 8 private $onRight; 9 9 private $number; 10 10 private $length; 11 + private $renderer; 12 + 13 + public function setRenderer($renderer) { 14 + $this->renderer = $renderer; 15 + return $this; 16 + } 17 + 18 + public function getRenderer() { 19 + return $this->renderer; 20 + } 11 21 12 22 public function addHiddenInput($key, $value) { 13 23 $this->inputs[] = array($key, $value); ··· 60 70 $this->renderBody(), 61 71 )); 62 72 63 - return phutil_tag('table', array(), phutil_tag( 64 - 'tr', 65 - array('class' => 'inline-comment-splint'), 66 - array( 73 + if ($this->renderer == '1up') { 74 + $cells = array( 75 + phutil_tag('th', array()), 76 + phutil_tag('th', array()), 77 + phutil_tag( 78 + 'td', 79 + array('colspan' => 3, 'class' => 'right3'), 80 + $content), 81 + ); 82 + } else { 83 + $cells = array( 67 84 phutil_tag('th', array()), 68 85 phutil_tag( 69 86 'td', ··· 74 91 'td', 75 92 array('colspan' => 3, 'class' => 'right3'), 76 93 $this->onRight ? $content : null), 77 - ))); 94 + ); 95 + } 96 + 97 + $row = phutil_tag('tr', array('class' => 'inline-comment-splint'), $cells); 98 + return phutil_tag('table', array(), $row); 78 99 } 79 100 80 101 private function renderInputs() {
+28 -5
src/applications/differential/view/DifferentialInlineCommentView.php
··· 10 10 private $editable; 11 11 private $preview; 12 12 private $allowReply; 13 + private $renderer; 13 14 14 15 public function setInlineComment(PhabricatorInlineCommentInterface $comment) { 15 16 $this->inlineComment = $comment; ··· 50 51 public function setAllowReply($allow_reply) { 51 52 $this->allowReply = $allow_reply; 52 53 return $this; 54 + } 55 + 56 + public function setRenderer($renderer) { 57 + $this->renderer = $renderer; 58 + return $this; 59 + } 60 + 61 + public function getRenderer() { 62 + return $this->renderer; 53 63 } 54 64 55 65 public function render() { ··· 251 261 return $markup; 252 262 } 253 263 254 - $left_markup = !$this->onRight ? $markup : ''; 255 - $right_markup = $this->onRight ? $markup : ''; 264 + if ($this->renderer == '1up') { 265 + $cells = array( 266 + phutil_tag('th', array()), 267 + phutil_tag('th', array()), 268 + phutil_tag( 269 + 'td', 270 + array('colspan' => 3, 'class' => 'right3'), 271 + $markup), 272 + ); 273 + } else { 274 + $left_markup = !$this->onRight ? $markup : ''; 275 + $right_markup = $this->onRight ? $markup : ''; 256 276 257 - return phutil_tag('table', array(), 258 - phutil_tag('tr', array(), array( 277 + $cells = array( 259 278 phutil_tag('th', array()), 260 279 phutil_tag('td', array('class' => 'left'), $left_markup), 261 280 phutil_tag('th', array()), ··· 263 282 'td', 264 283 array('colspan' => 3, 'class' => 'right3'), 265 284 $right_markup), 266 - ))); 285 + ); 286 + } 287 + 288 + $row = phutil_tag('tr', array(), $cells); 289 + return phutil_tag('table', array(), $row); 267 290 } 268 291 269 292 }
+35 -23
src/infrastructure/diff/PhabricatorInlineCommentController.php
··· 19 19 private $commentText; 20 20 private $operation; 21 21 private $commentID; 22 + private $renderer; 22 23 23 24 public function getCommentID() { 24 25 return $this->commentID; ··· 52 53 return $this->isNewFile; 53 54 } 54 55 56 + public function setRenderer($renderer) { 57 + $this->renderer = $renderer; 58 + return $this; 59 + } 60 + 61 + public function getRenderer() { 62 + return $this->renderer; 63 + } 55 64 56 65 public function processRequest() { 57 66 $request = $this->getRequest(); ··· 113 122 return id(new AphrontAjaxResponse()) 114 123 ->setContent($edit_dialog->render()); 115 124 case 'create': 116 - 117 125 $text = $this->getCommentText(); 118 126 119 127 if (!$request->isFormPost() || !strlen($text)) { ··· 157 165 $edit_dialog->addHiddenInput('is_new', $is_new); 158 166 $edit_dialog->addHiddenInput('number', $number); 159 167 $edit_dialog->addHiddenInput('length', $length); 168 + $edit_dialog->addHiddenInput('renderer', $this->getRenderer()); 160 169 161 170 $text_area = $this->renderTextArea($this->getCommentText()); 162 171 $edit_dialog->appendChild($text_area); ··· 171 180 172 181 // NOTE: This isn't necessarily a DifferentialChangeset ID, just an 173 182 // application identifier for the changeset. In Diffusion, it's a Path ID. 174 - $this->changesetID = $request->getInt('changeset'); 183 + $this->changesetID = $request->getInt('changeset'); 175 184 176 - $this->isNewFile = (int)$request->getBool('is_new'); 177 - $this->isOnRight = $request->getBool('on_right'); 178 - $this->lineNumber = $request->getInt('number'); 179 - $this->lineLength = $request->getInt('length'); 180 - $this->commentText = $request->getStr('text'); 181 - $this->commentID = $request->getInt('id'); 182 - $this->operation = $request->getStr('op'); 185 + $this->isNewFile = (int)$request->getBool('is_new'); 186 + $this->isOnRight = $request->getBool('on_right'); 187 + $this->lineNumber = $request->getInt('number'); 188 + $this->lineLength = $request->getInt('length'); 189 + $this->commentText = $request->getStr('text'); 190 + $this->commentID = $request->getInt('id'); 191 + $this->operation = $request->getStr('op'); 192 + $this->renderer = $request->getStr('renderer'); 183 193 } 184 194 185 195 private function buildEditDialog() { 186 196 $request = $this->getRequest(); 187 197 $user = $request->getUser(); 188 198 189 - $edit_dialog = new DifferentialInlineCommentEditView(); 190 - $edit_dialog->setUser($user); 191 - $edit_dialog->setSubmitURI($request->getRequestURI()); 192 - $edit_dialog->setOnRight($this->getIsOnRight()); 193 - $edit_dialog->setNumber($this->getLineNumber()); 194 - $edit_dialog->setLength($this->getLineLength()); 199 + $edit_dialog = id(new DifferentialInlineCommentEditView()) 200 + ->setUser($user) 201 + ->setSubmitURI($request->getRequestURI()) 202 + ->setOnRight($this->getIsOnRight()) 203 + ->setNumber($this->getLineNumber()) 204 + ->setLength($this->getLineLength()) 205 + ->setRenderer($this->getRenderer()); 195 206 196 207 return $edit_dialog; 197 208 } ··· 200 211 return id(new AphrontAjaxResponse()) 201 212 ->setContent( 202 213 array( 203 - 'markup' => '', 214 + 'markup' => '', 204 215 )); 205 216 } 206 217 ··· 222 233 223 234 $handles = $this->loadViewerHandles($phids); 224 235 225 - $view = new DifferentialInlineCommentView(); 226 - $view->setInlineComment($inline); 227 - $view->setOnRight($on_right); 228 - $view->setBuildScaffolding(true); 229 - $view->setMarkupEngine($engine); 230 - $view->setHandles($handles); 231 - $view->setEditable(true); 236 + $view = id(new DifferentialInlineCommentView()) 237 + ->setInlineComment($inline) 238 + ->setOnRight($on_right) 239 + ->setBuildScaffolding(true) 240 + ->setMarkupEngine($engine) 241 + ->setHandles($handles) 242 + ->setEditable(true) 243 + ->setRenderer($this->getRenderer()); 232 244 233 245 return id(new AphrontAjaxResponse()) 234 246 ->setContent(
+4 -2
webroot/rsrc/js/application/differential/DifferentialInlineCommentEditor.js
··· 35 35 is_new : this.getIsNew(), 36 36 length : this.getLength(), 37 37 changeset : this.getChangeset(), 38 - text : this.getText() || '' 38 + text : this.getText() || '', 39 + renderer: this.getRenderer() 39 40 }; 40 41 }, 41 42 _draw : function(content, exact_row) { ··· 288 289 isNew : null, 289 290 text : null, 290 291 templates : null, 291 - originalText : null 292 + originalText : null, 293 + renderer: null 292 294 } 293 295 294 296 });
+3
webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js
··· 150 150 insert = target.parentNode; 151 151 } 152 152 153 + var view = JX.ChangesetViewManager.getForNode(root); 154 + 153 155 editor = new JX.DifferentialInlineCommentEditor(config.uri) 154 156 .setTemplates(config.undo_templates) 155 157 .setOperation('new') ··· 160 162 .setOnRight(isOnRight(target) ? 1 : 0) 161 163 .setRow(insert.nextSibling) 162 164 .setTable(insert.parentNode) 165 + .setRenderer(view.getRenderer()) 163 166 .start(); 164 167 165 168 set_link_state(true);