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

Make client inlines track an "active" state

Summary:
Ref T13559. Rather than reading from the document, make client inlines actively track their current "active" state.

The "active" state is what the user currently sees in the client UI.

Test Plan: Created inlines, etc. See followups.

Maniphest Tasks: T13559

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

+74 -28
+12 -12
resources/celerity/map.php
··· 13 13 'core.pkg.js' => 'ab3502fe', 14 14 'dark-console.pkg.js' => '187792c2', 15 15 'differential.pkg.css' => 'ffb69e3d', 16 - 'differential.pkg.js' => '5e0c7197', 16 + 'differential.pkg.js' => '68a2e7be', 17 17 'diffusion.pkg.css' => '42c75c37', 18 18 'diffusion.pkg.js' => '78c9885d', 19 19 'maniphest.pkg.css' => '35995d6d', ··· 385 385 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8', 386 386 'rsrc/js/application/diff/DiffChangeset.js' => 'd7d3ba75', 387 387 'rsrc/js/application/diff/DiffChangesetList.js' => 'cc2c5de5', 388 - 'rsrc/js/application/diff/DiffInline.js' => '09e0c6e5', 389 - 'rsrc/js/application/diff/DiffInlineContentState.js' => 'cb9e5396', 388 + 'rsrc/js/application/diff/DiffInline.js' => 'a5f196da', 389 + 'rsrc/js/application/diff/DiffInlineContentState.js' => '68e6339d', 390 390 'rsrc/js/application/diff/DiffPathView.js' => '8207abf9', 391 391 'rsrc/js/application/diff/DiffTreeView.js' => '5d83623b', 392 392 'rsrc/js/application/differential/behavior-diff-radios.js' => '925fe8cd', ··· 788 788 'phabricator-dashboard-css' => '5a205b9d', 789 789 'phabricator-diff-changeset' => 'd7d3ba75', 790 790 'phabricator-diff-changeset-list' => 'cc2c5de5', 791 - 'phabricator-diff-inline' => '09e0c6e5', 792 - 'phabricator-diff-inline-content-state' => 'cb9e5396', 791 + 'phabricator-diff-inline' => 'a5f196da', 792 + 'phabricator-diff-inline-content-state' => '68e6339d', 793 793 'phabricator-diff-path-view' => '8207abf9', 794 794 'phabricator-diff-tree-view' => '5d83623b', 795 795 'phabricator-drag-and-drop-file-upload' => '4370900d', ··· 1000 1000 'herald-rule-editor', 1001 1001 'javelin-behavior', 1002 1002 ), 1003 - '09e0c6e5' => array( 1004 - 'javelin-dom', 1005 - 'phabricator-diff-inline-content-state', 1006 - ), 1007 1003 '0ad8d31f' => array( 1008 1004 'javelin-behavior', 1009 1005 'javelin-stratcom', ··· 1544 1540 'javelin-install', 1545 1541 'javelin-dom', 1546 1542 ), 1543 + '68e6339d' => array( 1544 + 'javelin-dom', 1545 + ), 1547 1546 '6a1583a8' => array( 1548 1547 'javelin-behavior', 1549 1548 'javelin-history', ··· 1872 1871 'javelin-install', 1873 1872 'javelin-dom', 1874 1873 ), 1874 + 'a5f196da' => array( 1875 + 'javelin-dom', 1876 + 'phabricator-diff-inline-content-state', 1877 + ), 1875 1878 'a77e2cbd' => array( 1876 1879 'javelin-behavior', 1877 1880 'javelin-stratcom', ··· 2088 2091 'javelin-util', 2089 2092 'javelin-workflow', 2090 2093 'javelin-json', 2091 - ), 2092 - 'cb9e5396' => array( 2093 - 'javelin-dom', 2094 2094 ), 2095 2095 'cc2c5de5' => array( 2096 2096 'javelin-install',
+13 -16
webroot/rsrc/js/application/diff/DiffInline.js
··· 416 416 .send(); 417 417 }, 418 418 419 - _getContentState: function() { 420 - var state; 421 - 422 - if (this._editRow) { 423 - state = this._readFormState(this._editRow); 424 - } else { 425 - state = this._originalState; 426 - } 427 - 428 - return state; 429 - }, 430 - 431 419 reply: function(with_quote) { 432 420 this._closeMenu(); 433 421 434 422 var content_state = this._newContentState(); 435 423 if (with_quote) { 436 - var text = this._getContentState().text; 437 - text = '> ' + text.replace(/\n/g, '\n> ') + '\n\n'; 424 + var text = this._getActiveContentState().getTextForQuote(); 438 425 content_state.text = text; 439 426 } 440 427 ··· 607 594 _readInlineState: function(state) { 608 595 this._id = state.id; 609 596 this._originalState = state.contentState; 597 + 598 + this._getActiveContentState().readWireFormat(state.contentState); 599 + 610 600 this._canSuggestEdit = state.canSuggestEdit; 611 601 }, 612 602 ··· 790 780 }, 791 781 792 782 _getActiveContentState: function() { 793 - return this._activeContentState; 783 + var state = this._activeContentState; 784 + 785 + if (this._editRow) { 786 + state.readForm(this._editRow); 787 + } 788 + 789 + return state; 794 790 }, 795 791 796 792 setHasSuggestion: function(has_suggestion) { ··· 819 815 }, 820 816 821 817 save: function() { 818 + var state = this._getActiveContentState(); 822 819 var handler = JX.bind(this, this._onsubmitresponse); 823 820 824 821 this.setLoading(true); 825 822 826 823 var uri = this._getInlineURI(); 827 - var data = this._newRequestData('save', this._getContentState()); 824 + var data = this._newRequestData('save', state.getWireFormat()); 828 825 829 826 new JX.Request(uri, handler) 830 827 .setData(data)
+49
webroot/rsrc/js/application/diff/DiffInlineContentState.js
··· 17 17 }, 18 18 19 19 members: { 20 + readForm: function(row) { 21 + var node; 22 + 23 + try { 24 + node = JX.DOM.find(row, 'textarea', 'inline-content-text'); 25 + this.setText(node.value); 26 + } catch (ex) { 27 + this.setText(null); 28 + } 29 + 30 + node = this._getSuggestionNode(row); 31 + if (node) { 32 + this.setSuggestionText(node.value); 33 + } else { 34 + this.setSuggestionText(null); 35 + } 36 + 37 + return this; 38 + }, 39 + 40 + getWireFormat: function() { 41 + return { 42 + text: this.getText(), 43 + suggestionText: this.getSuggestionText(), 44 + hasSuggestion: this.getHasSuggestion() 45 + }; 46 + }, 47 + 48 + readWireFormat: function(map) { 49 + this.setText(map.text || null); 50 + this.setSuggestionText(map.suggestionText || null); 51 + this.setHasSuggestion(!!map.hasSuggestion); 52 + 53 + return this; 54 + }, 55 + 56 + getTextForQuote: function() { 57 + var text = this.getText(); 58 + text = '> ' + text.replace(/\n/g, '\n> ') + '\n\n'; 59 + return text; 60 + }, 61 + 62 + _getSuggestionNode: function(row) { 63 + try { 64 + return JX.DOM.find(row, 'textarea', 'inline-content-suggestion'); 65 + } catch (ex) { 66 + return null; 67 + } 68 + } 20 69 } 21 70 22 71 });