Skip to content

Commit b964731

Browse files
author
epriestley
committedMar 29, 2021
Make inline "ContentState" a client object, and track "hasSuggestion" on it
Summary: Ref T13559. In an effort to ultimately fix the "quote + cancel" bug, begin formalizing content states on the client. This creates a "ContentState" client object and moves the authoritative storage for the "hasSuggestion" property to it. Test Plan: Created inlines, etc. See followups. Maniphest Tasks: T13559 Differential Revision: https://secure.phabricator.com/D21645
1 parent 87c6c27 commit b964731

File tree

4 files changed

+48
-9
lines changed

4 files changed

+48
-9
lines changed
 

‎resources/celerity/map.php

+13-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'core.pkg.js' => 'ab3502fe',
1414
'dark-console.pkg.js' => '187792c2',
1515
'differential.pkg.css' => 'ffb69e3d',
16-
'differential.pkg.js' => 'd1150814',
16+
'differential.pkg.js' => '5e0c7197',
1717
'diffusion.pkg.css' => '42c75c37',
1818
'diffusion.pkg.js' => '78c9885d',
1919
'maniphest.pkg.css' => '35995d6d',
@@ -385,7 +385,8 @@
385385
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8',
386386
'rsrc/js/application/diff/DiffChangeset.js' => 'd7d3ba75',
387387
'rsrc/js/application/diff/DiffChangesetList.js' => 'cc2c5de5',
388-
'rsrc/js/application/diff/DiffInline.js' => '511a1315',
388+
'rsrc/js/application/diff/DiffInline.js' => '09e0c6e5',
389+
'rsrc/js/application/diff/DiffInlineContentState.js' => 'cb9e5396',
389390
'rsrc/js/application/diff/DiffPathView.js' => '8207abf9',
390391
'rsrc/js/application/diff/DiffTreeView.js' => '5d83623b',
391392
'rsrc/js/application/differential/behavior-diff-radios.js' => '925fe8cd',
@@ -787,7 +788,8 @@
787788
'phabricator-dashboard-css' => '5a205b9d',
788789
'phabricator-diff-changeset' => 'd7d3ba75',
789790
'phabricator-diff-changeset-list' => 'cc2c5de5',
790-
'phabricator-diff-inline' => '511a1315',
791+
'phabricator-diff-inline' => '09e0c6e5',
792+
'phabricator-diff-inline-content-state' => 'cb9e5396',
791793
'phabricator-diff-path-view' => '8207abf9',
792794
'phabricator-diff-tree-view' => '5d83623b',
793795
'phabricator-drag-and-drop-file-upload' => '4370900d',
@@ -998,6 +1000,10 @@
9981000
'herald-rule-editor',
9991001
'javelin-behavior',
10001002
),
1003+
'09e0c6e5' => array(
1004+
'javelin-dom',
1005+
'phabricator-diff-inline-content-state',
1006+
),
10011007
'0ad8d31f' => array(
10021008
'javelin-behavior',
10031009
'javelin-stratcom',
@@ -1399,9 +1405,6 @@
13991405
'javelin-stratcom',
14001406
'javelin-dom',
14011407
),
1402-
'511a1315' => array(
1403-
'javelin-dom',
1404-
),
14051408
'5202e831' => array(
14061409
'javelin-install',
14071410
'javelin-dom',
@@ -2086,6 +2089,9 @@
20862089
'javelin-workflow',
20872090
'javelin-json',
20882091
),
2092+
'cb9e5396' => array(
2093+
'javelin-dom',
2094+
),
20892095
'cc2c5de5' => array(
20902096
'javelin-install',
20912097
'phuix-button-view',
@@ -2441,6 +2447,7 @@
24412447
'javelin-behavior-phabricator-object-selector',
24422448
'javelin-behavior-repository-crossreference',
24432449
'javelin-behavior-aphront-more',
2450+
'phabricator-diff-inline-content-state',
24442451
'phabricator-diff-inline',
24452452
'phabricator-diff-changeset',
24462453
'phabricator-diff-changeset-list',

‎resources/celerity/packages.php

+1
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@
212212

213213
'javelin-behavior-aphront-more',
214214

215+
'phabricator-diff-inline-content-state',
215216
'phabricator-diff-inline',
216217
'phabricator-diff-changeset',
217218
'phabricator-diff-changeset-list',

‎webroot/rsrc/js/application/diff/DiffInline.js

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
/**
22
* @provides phabricator-diff-inline
33
* @requires javelin-dom
4+
* phabricator-diff-inline-content-state
45
* @javelin
56
*/
67

78
JX.install('DiffInline', {
89

910
construct : function() {
11+
this._activeContentState = new JX.DiffInlineContentState();
1012
},
1113

1214
members: {
@@ -53,6 +55,8 @@ JX.install('DiffInline', {
5355
_isSelected: false,
5456
_canSuggestEdit: false,
5557

58+
_activeContentState: null,
59+
5660
bindToRow: function(row) {
5761
this._row = row;
5862

@@ -785,8 +789,13 @@ JX.install('DiffInline', {
785789
this.triggerDraft();
786790
},
787791

792+
_getActiveContentState: function() {
793+
return this._activeContentState;
794+
},
795+
788796
setHasSuggestion: function(has_suggestion) {
789-
this._hasSuggestion = has_suggestion;
797+
var state = this._getActiveContentState();
798+
state.setHasSuggestion(has_suggestion);
790799

791800
var button = this._getSuggestionButton();
792801
var pht = this.getChangeset().getChangesetList().getTranslations();
@@ -806,7 +815,7 @@ JX.install('DiffInline', {
806815
},
807816

808817
getHasSuggestion: function() {
809-
return this._hasSuggestion;
818+
return this._getActiveContentState().getHasSuggestion();
810819
},
811820

812821
save: function() {
@@ -920,7 +929,7 @@ JX.install('DiffInline', {
920929
state.suggestionText = node.value;
921930
}
922931

923-
state.hasSuggestion = this.getHasSuggestion();
932+
state.hasSuggestion = this._getActiveContentState().getHasSuggestion();
924933

925934
return state;
926935
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* @provides phabricator-diff-inline-content-state
3+
* @requires javelin-dom
4+
* @javelin
5+
*/
6+
7+
JX.install('DiffInlineContentState', {
8+
9+
construct : function() {
10+
11+
},
12+
13+
properties: {
14+
text: null,
15+
suggestionText: null,
16+
hasSuggestion: false
17+
},
18+
19+
members: {
20+
}
21+
22+
});

0 commit comments

Comments
 (0)
Failed to load comments.