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

When creating an inline, save the current document engine

Summary:
Ref T13513. As part of inline metadata, save the document engine the change is being rendered with.

This will allow other parts of the UI to detect that an inline was created on a Jupyter notebook but is being rendered on raw source, or whatever else.

The immediate goal is to fix nonsensical inline snippet rendering in email on Jupyter notebooks.

Test Plan:
- Created inlines and replies on normal soure code, saw no document engine annotated in the database.
- Created inlines and replies on a Jupyter notebook rendered in Jupyter mode, saw "jupyter" annotations in the database.
- Swapped document engines between Jupyter and Source, etc.

Maniphest Tasks: T13513

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

+75 -39
+28 -28
resources/celerity/map.php
··· 13 13 'core.pkg.js' => '1e667bcb', 14 14 'dark-console.pkg.js' => '187792c2', 15 15 'differential.pkg.css' => 'd71d4531', 16 - 'differential.pkg.js' => '5be7941a', 16 + 'differential.pkg.js' => '5ec354a0', 17 17 'diffusion.pkg.css' => '42c75c37', 18 18 'diffusion.pkg.js' => 'a98c0bf7', 19 19 'maniphest.pkg.css' => '35995d6d', ··· 379 379 'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => 'a2ab19be', 380 380 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '1e413dc9', 381 381 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8', 382 - 'rsrc/js/application/diff/DiffChangeset.js' => '700bf848', 383 - 'rsrc/js/application/diff/DiffChangesetList.js' => '6e668c5b', 384 - 'rsrc/js/application/diff/DiffInline.js' => '9a3963e0', 382 + 'rsrc/js/application/diff/DiffChangeset.js' => '10ddd7e0', 383 + 'rsrc/js/application/diff/DiffChangesetList.js' => '303efc90', 384 + 'rsrc/js/application/diff/DiffInline.js' => 'a0ef0b54', 385 385 'rsrc/js/application/diff/DiffPathView.js' => '8207abf9', 386 386 'rsrc/js/application/diff/DiffTreeView.js' => '5d83623b', 387 387 'rsrc/js/application/differential/behavior-diff-radios.js' => '925fe8cd', ··· 774 774 'phabricator-darklog' => '3b869402', 775 775 'phabricator-darkmessage' => '26cd4b73', 776 776 'phabricator-dashboard-css' => '5a205b9d', 777 - 'phabricator-diff-changeset' => '700bf848', 778 - 'phabricator-diff-changeset-list' => '6e668c5b', 779 - 'phabricator-diff-inline' => '9a3963e0', 777 + 'phabricator-diff-changeset' => '10ddd7e0', 778 + 'phabricator-diff-changeset-list' => '303efc90', 779 + 'phabricator-diff-inline' => 'a0ef0b54', 780 780 'phabricator-diff-path-view' => '8207abf9', 781 781 'phabricator-diff-tree-view' => '5d83623b', 782 782 'phabricator-drag-and-drop-file-upload' => '4370900d', ··· 1020 1020 'javelin-workflow', 1021 1021 'phuix-icon-view', 1022 1022 ), 1023 + '10ddd7e0' => array( 1024 + 'javelin-dom', 1025 + 'javelin-util', 1026 + 'javelin-stratcom', 1027 + 'javelin-install', 1028 + 'javelin-workflow', 1029 + 'javelin-router', 1030 + 'javelin-behavior-device', 1031 + 'javelin-vector', 1032 + 'phabricator-diff-inline', 1033 + 'phabricator-diff-path-view', 1034 + 'phuix-button-view', 1035 + ), 1023 1036 '111bfd2d' => array( 1024 1037 'javelin-install', 1025 1038 ), ··· 1175 1188 'phuix-icon-view', 1176 1189 'phabricator-prefab', 1177 1190 ), 1191 + '303efc90' => array( 1192 + 'javelin-install', 1193 + 'phuix-button-view', 1194 + 'phabricator-diff-tree-view', 1195 + ), 1178 1196 '308f9fe4' => array( 1179 1197 'javelin-install', 1180 1198 'javelin-util', ··· 1545 1563 'javelin-install', 1546 1564 'javelin-util', 1547 1565 ), 1548 - '6e668c5b' => array( 1549 - 'javelin-install', 1550 - 'phuix-button-view', 1551 - 'phabricator-diff-tree-view', 1552 - ), 1553 - '700bf848' => array( 1554 - 'javelin-dom', 1555 - 'javelin-util', 1556 - 'javelin-stratcom', 1557 - 'javelin-install', 1558 - 'javelin-workflow', 1559 - 'javelin-router', 1560 - 'javelin-behavior-device', 1561 - 'javelin-vector', 1562 - 'phabricator-diff-inline', 1563 - 'phabricator-diff-path-view', 1564 - 'phuix-button-view', 1565 - ), 1566 1566 70245195 => array( 1567 1567 'javelin-behavior', 1568 1568 'javelin-stratcom', ··· 1808 1808 'javelin-request', 1809 1809 'javelin-router', 1810 1810 ), 1811 - '9a3963e0' => array( 1812 - 'javelin-dom', 1813 - ), 1814 1811 '9aae2b66' => array( 1815 1812 'javelin-install', 1816 1813 'javelin-util', ··· 1835 1832 'javelin-workflow', 1836 1833 'javelin-util', 1837 1834 'phabricator-keyboard-shortcut', 1835 + ), 1836 + 'a0ef0b54' => array( 1837 + 'javelin-dom', 1838 1838 ), 1839 1839 'a17b84f1' => array( 1840 1840 'javelin-behavior',
+9 -1
src/applications/differential/parser/DifferentialChangesetParser.php
··· 1871 1871 $undo_templates[$key] = hsprintf('%s', $undo_template); 1872 1872 } 1873 1873 1874 + $document_engine = $renderer->getDocumentEngine(); 1875 + if ($document_engine) { 1876 + $document_engine_key = $document_engine->getDocumentEngineKey(); 1877 + } else { 1878 + $document_engine_key = null; 1879 + } 1880 + 1874 1881 $state = array( 1875 1882 'undoTemplates' => $undo_templates, 1876 1883 'rendererKey' => $renderer_key, 1877 1884 'highlight' => $viewstate->getHighlightLanguage(), 1878 1885 'characterEncoding' => $viewstate->getCharacterEncoding(), 1879 - 'documentEngine' => $viewstate->getDocumentEngineKey(), 1886 + 'requestDocumentEngineKey' => $viewstate->getDocumentEngineKey(), 1887 + 'responseDocumentEngineKey' => $document_engine_key, 1880 1888 'isHidden' => $viewstate->getHidden(), 1881 1889 ); 1882 1890
+6 -3
src/infrastructure/diff/PhabricatorInlineCommentController.php
··· 296 296 $draft_engine = $this->newDraftEngine(); 297 297 if ($draft_engine) { 298 298 $draft_engine->synchronize(); 299 - } else { 300 - phlog('no draft engine'); 301 299 } 302 300 303 301 return $this->buildEmptyResponse(); ··· 320 318 ->setIsNewFile($is_new) 321 319 ->setLineNumber($number) 322 320 ->setLineLength($length) 323 - ->setContent($this->getCommentText()) 321 + ->setContent((string)$this->getCommentText()) 324 322 ->setReplyToCommentPHID($this->getReplyToCommentPHID()) 325 323 ->setIsEditing(true); 324 + 325 + $document_engine_key = $request->getStr('documentEngineKey'); 326 + if ($document_engine_key !== null) { 327 + $inline->setDocumentEngineKey($document_engine_key); 328 + } 326 329 327 330 // If you own this object, mark your own inlines as "Done" by default. 328 331 $owner_phid = $this->loadObjectOwnerPHID($inline);
+9
src/infrastructure/diff/interface/PhabricatorInlineComment.php
··· 213 213 return (bool)$this->getStorageObject()->getAttribute('editing', false); 214 214 } 215 215 216 + public function setDocumentEngineKey($engine_key) { 217 + $this->getStorageObject()->setAttribute('documentEngineKey', $engine_key); 218 + return $this; 219 + } 220 + 221 + public function getDocumentEngineKey() { 222 + return $this->getStorageObject()->getAttribute('documentEngineKey'); 223 + } 224 + 216 225 public function getDateModified() { 217 226 return $this->getStorageObject()->getDateModified(); 218 227 }
+1
src/infrastructure/diff/view/PHUIDiffInlineCommentView.php
··· 90 90 'isSynthetic' => $is_synthetic, 91 91 'isDraftDone' => $is_draft_done, 92 92 'isEditing' => $inline->getIsEditing(), 93 + 'documentEngineKey' => $inline->getDocumentEngineKey(), 93 94 94 95 'on_right' => $this->getIsOnRight(), 95 96 );
+10 -4
webroot/rsrc/js/application/diff/DiffChangeset.js
··· 64 64 _ref: null, 65 65 _rendererKey: null, 66 66 _highlight: null, 67 - _documentEngine: null, 67 + _requestDocumentEngineKey: null, 68 + _responseDocumentEngineKey: null, 68 69 _characterEncoding: null, 69 70 _undoTemplates: null, 70 71 ··· 411 412 return this._highlight; 412 413 }, 413 414 414 - getDocumentEngine: function(engine) { 415 - return this._documentEngine; 415 + getRequestDocumentEngineKey: function() { 416 + return this._requestDocumentEngineKey; 417 + }, 418 + 419 + getResponseDocumentEngineKey: function() { 420 + return this._responseDocumentEngineKey; 416 421 }, 417 422 418 423 getSelectableItems: function() { ··· 665 670 this._rendererKey = state.rendererKey; 666 671 this._highlight = state.highlight; 667 672 this._characterEncoding = state.characterEncoding; 668 - this._documentEngine = state.documentEngine; 673 + this._requestDocumentEngineKey = state.requestDocumentEngineKey; 674 + this._responseDocumentEngineKey = state.responseDocumentEngineKey; 669 675 this._isHidden = state.isHidden; 670 676 671 677 var is_hidden = !this.isVisible();
+1 -1
webroot/rsrc/js/application/diff/DiffChangesetList.js
··· 945 945 .setName(pht('View As Document Type...')) 946 946 .setHandler(function(e) { 947 947 var params = { 948 - engine: changeset.getDocumentEngine(), 948 + engine: changeset.getResponseDocumentEngineKey(), 949 949 }; 950 950 951 951 new JX.Workflow('/services/viewas/', params)
+11 -2
webroot/rsrc/js/application/diff/DiffInline.js
··· 21 21 _replyToCommentPHID: null, 22 22 _originalText: null, 23 23 _snippet: null, 24 + _documentEngineKey: null, 24 25 25 26 _isDeleted: false, 26 27 _isInvisible: false, ··· 88 89 this._changesetID = data.changesetID; 89 90 this._isNew = false; 90 91 this._snippet = data.snippet; 92 + this._documentEngineKey = data.documentEngineKey; 91 93 92 94 this._isEditing = data.isEditing; 93 95 ··· 174 176 this._isNewFile = inline._isNewFile; 175 177 this._changesetID = inline._changesetID; 176 178 this._isNew = true; 179 + this._documentEngineKey = inline._documentEngineKey; 177 180 178 181 this._replyToCommentPHID = inline._phid; 179 182 ··· 374 377 }, 375 378 376 379 create: function(text) { 380 + var changeset = this.getChangeset(); 381 + if (!this._documentEngineKey) { 382 + this._documentEngineKey = changeset.getResponseDocumentEngineKey(); 383 + } 384 + 377 385 var uri = this._getInlineURI(); 378 386 var handler = JX.bind(this, this._oncreateresponse); 379 387 var data = this._newRequestData('new', text); ··· 507 515 length: this.getLineLength(), 508 516 is_new: this.isNewFile(), 509 517 changesetID: this.getChangesetID(), 510 - replyToCommentPHID: this.getReplyToCommentPHID() || '', 511 - text: text || '' 518 + replyToCommentPHID: this.getReplyToCommentPHID(), 519 + text: text || null, 520 + documentEngineKey: this._documentEngineKey, 512 521 }; 513 522 }, 514 523