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

On inline comments, track an explicit "committed" content state

Summary:
Ref T13559. To allow the client to make correct decisions about what buttons mean, track an explicit "Committed" content state.

This is the last version of the comment that has been saved on the server, and does not exist if the comment has never been saved.

Test Plan: Created comments, etc. See followups.

Maniphest Tasks: T13559

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

+42 -24
+15 -15
resources/celerity/map.php
··· 10 10 'conpherence.pkg.css' => '0e3cf785', 11 11 'conpherence.pkg.js' => '020aebcf', 12 12 'core.pkg.css' => '0ae696de', 13 - 'core.pkg.js' => 'ab3502fe', 13 + 'core.pkg.js' => '68f29322', 14 14 'dark-console.pkg.js' => '187792c2', 15 15 'differential.pkg.css' => 'ffb69e3d', 16 - 'differential.pkg.js' => 'fdec5f60', 16 + 'differential.pkg.js' => 'bbf6d742', 17 17 'diffusion.pkg.css' => '42c75c37', 18 18 'diffusion.pkg.js' => '78c9885d', 19 19 'maniphest.pkg.css' => '35995d6d', ··· 253 253 'rsrc/externals/javelin/lib/Mask.js' => '7c4d8998', 254 254 'rsrc/externals/javelin/lib/Quicksand.js' => 'd3799cb4', 255 255 'rsrc/externals/javelin/lib/Request.js' => '84e6891f', 256 - 'rsrc/externals/javelin/lib/Resource.js' => '740956e1', 256 + 'rsrc/externals/javelin/lib/Resource.js' => '20514cc2', 257 257 'rsrc/externals/javelin/lib/Routable.js' => '6a18c42e', 258 258 'rsrc/externals/javelin/lib/Router.js' => '32755edb', 259 259 'rsrc/externals/javelin/lib/Scrollbar.js' => 'a43ae2ae', ··· 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' => '2a6fac17', 388 + 'rsrc/js/application/diff/DiffInline.js' => 'c794b624', 389 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', ··· 734 734 'javelin-reactor-node-calmer' => '225bbb98', 735 735 'javelin-reactornode' => '72960bc1', 736 736 'javelin-request' => '84e6891f', 737 - 'javelin-resource' => '740956e1', 737 + 'javelin-resource' => '20514cc2', 738 738 'javelin-routable' => '6a18c42e', 739 739 'javelin-router' => '32755edb', 740 740 'javelin-scrollbar' => 'a43ae2ae', ··· 788 788 'phabricator-dashboard-css' => '5a205b9d', 789 789 'phabricator-diff-changeset' => 'd7d3ba75', 790 790 'phabricator-diff-changeset-list' => 'cc2c5de5', 791 - 'phabricator-diff-inline' => '2a6fac17', 791 + 'phabricator-diff-inline' => 'c794b624', 792 792 'phabricator-diff-inline-content-state' => '68e6339d', 793 793 'phabricator-diff-path-view' => '8207abf9', 794 794 'phabricator-diff-tree-view' => '5d83623b', ··· 1106 1106 'javelin-behavior', 1107 1107 'javelin-request', 1108 1108 ), 1109 + '20514cc2' => array( 1110 + 'javelin-util', 1111 + 'javelin-uri', 1112 + 'javelin-install', 1113 + ), 1109 1114 '225bbb98' => array( 1110 1115 'javelin-install', 1111 1116 'javelin-reactor', ··· 1165 1170 'phabricator-notification', 1166 1171 'javelin-stratcom', 1167 1172 'javelin-behavior', 1168 - ), 1169 - '2a6fac17' => array( 1170 - 'javelin-dom', 1171 - 'phabricator-diff-inline-content-state', 1172 1173 ), 1173 1174 '2a8b62d9' => array( 1174 1175 'multirow-row-manager', ··· 1597 1598 'javelin-stratcom', 1598 1599 'phabricator-tooltip', 1599 1600 ), 1600 - '740956e1' => array( 1601 - 'javelin-util', 1602 - 'javelin-uri', 1603 - 'javelin-install', 1604 - ), 1605 1601 74446546 => array( 1606 1602 'javelin-behavior', 1607 1603 'javelin-dom', ··· 2091 2087 'javelin-util', 2092 2088 'javelin-workflow', 2093 2089 'javelin-json', 2090 + ), 2091 + 'c794b624' => array( 2092 + 'javelin-dom', 2093 + 'phabricator-diff-inline-content-state', 2094 2094 ), 2095 2095 'cc2c5de5' => array( 2096 2096 'javelin-install',
+4
webroot/rsrc/externals/javelin/lib/Resource.js
··· 149 149 } 150 150 } 151 151 152 + for (var jj = 0; jj < errors.length; jj++) { 153 + JX.log(errors[jj]); 154 + } 155 + 152 156 if (errors.length) { 153 157 throw errors[0]; 154 158 }
+23 -9
webroot/rsrc/js/application/diff/DiffInline.js
··· 9 9 10 10 construct : function() { 11 11 this._activeContentState = new JX.DiffInlineContentState(); 12 + this._committedContentState = new JX.DiffInlineContentState(); 12 13 }, 13 14 14 15 members: { ··· 21 22 _displaySide: null, 22 23 _isNewFile: null, 23 24 _replyToCommentPHID: null, 24 - _originalState: null, 25 25 _snippet: null, 26 26 _menuItems: null, 27 27 _documentEngineKey: null, ··· 56 56 _isSelected: false, 57 57 _canSuggestEdit: false, 58 58 59 + _committedContentState: null, 59 60 _activeContentState: null, 60 61 61 62 bindToRow: function(row) { ··· 336 337 this._phid = null; 337 338 this._isCollapsed = false; 338 339 339 - this._originalState = null; 340 - 341 340 return row; 342 341 }, 343 342 ··· 602 601 603 602 _readInlineState: function(state) { 604 603 this._id = state.id; 605 - this._originalState = state.contentState; 604 + 605 + // TODO: This is not the correct content state after a reload: it is 606 + // the draft state. 607 + this._getCommittedContentState().readWireFormat(state.contentState); 606 608 607 609 this._getActiveContentState().readWireFormat(state.contentState); 608 610 ··· 673 675 this._editRow = this._drawRows(rows, null, 'edit'); 674 676 675 677 this._drawSuggestionState(this._editRow); 676 - this.setHasSuggestion(this._originalState.hasSuggestion); 678 + 679 + // TODO: We're just doing this for the rendering side effect of drawing 680 + // the button text. 681 + this.setHasSuggestion(this.getHasSuggestion()); 677 682 }, 678 683 679 684 _drawRows: function(rows, cursor, type) { ··· 800 805 return state; 801 806 }, 802 807 808 + _getCommittedContentState: function() { 809 + return this._committedContentState; 810 + }, 811 + 803 812 setHasSuggestion: function(has_suggestion) { 804 813 var state = this._getActiveContentState(); 805 814 state.setHasSuggestion(has_suggestion); ··· 853 862 }, 854 863 855 864 _shouldUndoOnCancel: function() { 856 - var state = this._getActiveContentState().getWireFormat(); 865 + var new_state = this._getActiveContentState().getWireFormat(); 866 + var old_state = this._getCommittedContentState().getWireFormat(); 857 867 858 868 // TODO: This is also simplified. 859 869 860 - var is_empty = this._isVoidContentState(state); 861 - var is_same = this._isSameContentState(state, this._originalState); 870 + var is_empty = this._isVoidContentState(new_state); 871 + var is_same = this._isSameContentState(new_state, old_state); 862 872 863 873 if (!is_empty && !is_same) { 864 874 return true; ··· 956 966 this.setEditing(false); 957 967 this.setInvisible(false); 958 968 959 - this._applyCancel(this._originalState); 969 + var old_state = this._getCommittedContentState(); 970 + this._applyCancel(old_state.getWireFormat()); 960 971 961 972 this._didUpdate(true); 962 973 }, ··· 1184 1195 }, 1185 1196 1186 1197 _isVoidContentState: function(state) { 1198 + if (!state.text) { 1199 + return true; 1200 + } 1187 1201 return (!state.text.length && !state.suggestionText.length); 1188 1202 }, 1189 1203