1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

Consider inline comments with draft checkmarks as "unsubmitted"

Summary:
Ref T12733. When a revision has unsubmitted checkmarks:

  - Color the banner yellow.
  - Show them in the "X unsubmitted" count.
  - Make the "X unsubmitted" button cycle between all drafts (written but unpublished comments) and "draft done" (checked but unsubmitted "Done" checkbox comments).

Test Plan:
  - Checked a "Done" box, saw "1 unsubmitted" and yellow banner.
  - Clicked "5 unsubmitted" repeatedly, saw it cycle through all unsubmitted comments and checkboxes.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12733

Differential Revision: https://secure.phabricator.com/D18127
This commit is contained in:
epriestley 2017-06-15 04:28:21 -07:00
parent 887bd2d66e
commit 3be36783b3
6 changed files with 72 additions and 40 deletions

View file

@ -12,8 +12,8 @@ return array(
'core.pkg.css' => 'ab24402f', 'core.pkg.css' => 'ab24402f',
'core.pkg.js' => '1475bd91', 'core.pkg.js' => '1475bd91',
'darkconsole.pkg.js' => '1f9a31bc', 'darkconsole.pkg.js' => '1f9a31bc',
'differential.pkg.css' => '4e99863c', 'differential.pkg.css' => '4ec4a37a',
'differential.pkg.js' => 'ee50e5ae', 'differential.pkg.js' => '3442216b',
'diffusion.pkg.css' => 'b93d9b8c', 'diffusion.pkg.css' => 'b93d9b8c',
'diffusion.pkg.js' => '6134c5a1', 'diffusion.pkg.js' => '6134c5a1',
'favicon.ico' => '30672e08', 'favicon.ico' => '30672e08',
@ -64,7 +64,7 @@ return array(
'rsrc/css/application/dashboard/dashboard.css' => 'fe5b1869', 'rsrc/css/application/dashboard/dashboard.css' => 'fe5b1869',
'rsrc/css/application/diff/inline-comment-summary.css' => '51efda3a', 'rsrc/css/application/diff/inline-comment-summary.css' => '51efda3a',
'rsrc/css/application/differential/add-comment.css' => 'c47f8c40', 'rsrc/css/application/differential/add-comment.css' => 'c47f8c40',
'rsrc/css/application/differential/changeset-view.css' => 'c72dba88', 'rsrc/css/application/differential/changeset-view.css' => 'b5e6be7f',
'rsrc/css/application/differential/core.css' => '5b7b8ff4', 'rsrc/css/application/differential/core.css' => '5b7b8ff4',
'rsrc/css/application/differential/phui-inline-comment.css' => 'ffd1a542', 'rsrc/css/application/differential/phui-inline-comment.css' => 'ffd1a542',
'rsrc/css/application/differential/revision-comment.css' => '14b8565a', 'rsrc/css/application/differential/revision-comment.css' => '14b8565a',
@ -395,9 +395,9 @@ return array(
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '408bf173', 'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '408bf173',
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375', 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375',
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63', 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63',
'rsrc/js/application/diff/DiffChangeset.js' => '94f81a34', 'rsrc/js/application/diff/DiffChangeset.js' => 'cdc5fa19',
'rsrc/js/application/diff/DiffChangesetList.js' => 'fc6e482d', 'rsrc/js/application/diff/DiffChangesetList.js' => '4ca11264',
'rsrc/js/application/diff/DiffInline.js' => 'a386f83c', 'rsrc/js/application/diff/DiffInline.js' => '27b6d01f',
'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832', 'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832',
'rsrc/js/application/differential/behavior-comment-preview.js' => '51c5ad07', 'rsrc/js/application/differential/behavior-comment-preview.js' => '51c5ad07',
'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1', 'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1',
@ -562,7 +562,7 @@ return array(
'conpherence-thread-manager' => '4d863052', 'conpherence-thread-manager' => '4d863052',
'conpherence-transaction-css' => '85129c68', 'conpherence-transaction-css' => '85129c68',
'd3' => 'a11a5ff2', 'd3' => 'a11a5ff2',
'differential-changeset-view-css' => 'c72dba88', 'differential-changeset-view-css' => 'b5e6be7f',
'differential-core-view-css' => '5b7b8ff4', 'differential-core-view-css' => '5b7b8ff4',
'differential-revision-add-comment-css' => 'c47f8c40', 'differential-revision-add-comment-css' => 'c47f8c40',
'differential-revision-comment-css' => '14b8565a', 'differential-revision-comment-css' => '14b8565a',
@ -774,9 +774,9 @@ return array(
'phabricator-darklog' => 'c8e1ffe3', 'phabricator-darklog' => 'c8e1ffe3',
'phabricator-darkmessage' => 'c48cccdd', 'phabricator-darkmessage' => 'c48cccdd',
'phabricator-dashboard-css' => 'fe5b1869', 'phabricator-dashboard-css' => 'fe5b1869',
'phabricator-diff-changeset' => '94f81a34', 'phabricator-diff-changeset' => 'cdc5fa19',
'phabricator-diff-changeset-list' => 'fc6e482d', 'phabricator-diff-changeset-list' => '4ca11264',
'phabricator-diff-inline' => 'a386f83c', 'phabricator-diff-inline' => '27b6d01f',
'phabricator-drag-and-drop-file-upload' => '58dea2fa', 'phabricator-drag-and-drop-file-upload' => '58dea2fa',
'phabricator-draggable-list' => 'bea6e7f4', 'phabricator-draggable-list' => 'bea6e7f4',
'phabricator-fatal-config-template-css' => '8f18fa41', 'phabricator-fatal-config-template-css' => '8f18fa41',
@ -1056,6 +1056,9 @@ return array(
'phabricator-drag-and-drop-file-upload', 'phabricator-drag-and-drop-file-upload',
'javelin-workboard-board', 'javelin-workboard-board',
), ),
'27b6d01f' => array(
'javelin-dom',
),
'2926fff2' => array( '2926fff2' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-dom', 'javelin-dom',
@ -1231,6 +1234,10 @@ return array(
'javelin-uri', 'javelin-uri',
'phabricator-notification', 'phabricator-notification',
), ),
'4ca11264' => array(
'javelin-install',
'phuix-button-view',
),
'4d863052' => array( '4d863052' => array(
'javelin-dom', 'javelin-dom',
'javelin-util', 'javelin-util',
@ -1612,17 +1619,6 @@ return array(
'javelin-resource', 'javelin-resource',
'javelin-routable', 'javelin-routable',
), ),
'94f81a34' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
'phabricator-diff-inline',
),
'960f6a39' => array( '960f6a39' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-dom', 'javelin-dom',
@ -1667,9 +1663,6 @@ return array(
'javelin-install', 'javelin-install',
'javelin-dom', 'javelin-dom',
), ),
'a386f83c' => array(
'javelin-dom',
),
'a3a63478' => array( 'a3a63478' => array(
'phui-workcard-view-css', 'phui-workcard-view-css',
), ),
@ -1807,6 +1800,9 @@ return array(
'javelin-dom', 'javelin-dom',
'javelin-util', 'javelin-util',
), ),
'b5e6be7f' => array(
'phui-inline-comment-view-css',
),
'b6993408' => array( 'b6993408' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-stratcom', 'javelin-stratcom',
@ -1900,9 +1896,6 @@ return array(
'javelin-stratcom', 'javelin-stratcom',
'javelin-util', 'javelin-util',
), ),
'c72dba88' => array(
'phui-inline-comment-view-css',
),
'c7ccd872' => array( 'c7ccd872' => array(
'phui-fontkit-css', 'phui-fontkit-css',
), ),
@ -1963,6 +1956,17 @@ return array(
'cd2b9b77' => array( 'cd2b9b77' => array(
'phui-oi-list-view-css', 'phui-oi-list-view-css',
), ),
'cdc5fa19' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
'phabricator-diff-inline',
),
'd0a99ab4' => array( 'd0a99ab4' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-typeahead-ondemand-source', 'javelin-typeahead-ondemand-source',
@ -2154,10 +2158,6 @@ return array(
'javelin-behavior-device', 'javelin-behavior-device',
'phabricator-keyboard-shortcut', 'phabricator-keyboard-shortcut',
), ),
'fc6e482d' => array(
'javelin-install',
'phuix-button-view',
),
'fc91ab6c' => array( 'fc91ab6c' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-dom', 'javelin-dom',

View file

@ -107,6 +107,14 @@ final class PHUIDiffInlineCommentDetailView
break; break;
} }
$is_draft_done = false;
switch ($inline->getFixedState()) {
case PhabricatorInlineCommentInterface::STATE_DRAFT:
case PhabricatorInlineCommentInterface::STATE_UNDRAFT:
$is_draft_done = true;
break;
}
$is_synthetic = false; $is_synthetic = false;
if ($inline->getSyntheticAuthor()) { if ($inline->getSyntheticAuthor()) {
$is_synthetic = true; $is_synthetic = true;
@ -126,6 +134,7 @@ final class PHUIDiffInlineCommentDetailView
'isFixed' => $is_fixed, 'isFixed' => $is_fixed,
'isGhost' => $inline->getIsGhost(), 'isGhost' => $inline->getIsGhost(),
'isSynthetic' => $is_synthetic, 'isSynthetic' => $is_synthetic,
'isDraftDone' => $is_draft_done,
); );
$sigil = 'differential-inline-comment'; $sigil = 'differential-inline-comment';

View file

@ -415,7 +415,8 @@ tr.differential-inline-loading {
} }
.diff-banner-has-unsaved, .diff-banner-has-unsaved,
.diff-banner-has-unsubmitted { .diff-banner-has-unsubmitted,
.diff-banner-has-draft-done {
background: {$sh-yellowbackground}; background: {$sh-yellowbackground};
} }

View file

@ -454,7 +454,7 @@ JX.install('DiffChangeset', {
}, },
attributes: { attributes: {
unsaved: inline.isEditing(), unsaved: inline.isEditing(),
unsubmitted: inline.isDraft(), anyDraft: inline.isDraft() || inline.isDraftDone(),
undone: (is_saved && !inline.isDone()), undone: (is_saved && !inline.isDone()),
done: (is_saved && inline.isDone()) done: (is_saved && inline.isDone())
} }

View file

@ -1332,6 +1332,7 @@ JX.install('DiffChangesetList', {
var changesets = this._changesets; var changesets = this._changesets;
var unsaved = []; var unsaved = [];
var unsubmitted = []; var unsubmitted = [];
var draft_done = [];
var undone = []; var undone = [];
var done = []; var done = [];
@ -1356,10 +1357,18 @@ JX.install('DiffChangesetList', {
continue; continue;
} else if (inline.isDraft()) { } else if (inline.isDraft()) {
unsubmitted.push(inline); unsubmitted.push(inline);
} else if (!inline.isDone()) {
undone.push(inline);
} else { } else {
done.push(inline); // NOTE: Unlike other states, an inline may be marked with a
// draft checkmark and still be a "done" or "undone" comment.
if (inline.isDraftDone()) {
draft_done.push(inline);
}
if (!inline.isDone()) {
undone.push(inline);
} else {
done.push(inline);
}
} }
} }
} }
@ -1374,6 +1383,11 @@ JX.install('DiffChangesetList', {
'diff-banner-has-unsubmitted', 'diff-banner-has-unsubmitted',
!!unsubmitted.length); !!unsubmitted.length);
JX.DOM.alterClass(
node,
'diff-banner-has-draft-done',
!!draft_done.length);
var pht = this.getTranslations(); var pht = this.getTranslations();
var unsaved_button = this._getUnsavedButton(); var unsaved_button = this._getUnsavedButton();
var unsubmitted_button = this._getUnsubmittedButton(); var unsubmitted_button = this._getUnsubmittedButton();
@ -1386,9 +1400,10 @@ JX.install('DiffChangesetList', {
JX.DOM.hide(unsaved_button.getNode()); JX.DOM.hide(unsaved_button.getNode());
} }
if (unsubmitted.length) { if (unsubmitted.length || draft_done.length) {
unsubmitted_button.setText( var any_draft_count = unsubmitted.length + draft_done.length;
unsubmitted.length + ' ' + pht('Unsubmitted'));
unsubmitted_button.setText(any_draft_count + ' ' + pht('Unsubmitted'));
JX.DOM.show(unsubmitted_button.getNode()); JX.DOM.show(unsubmitted_button.getNode());
} else { } else {
JX.DOM.hide(unsubmitted_button.getNode()); JX.DOM.hide(unsubmitted_button.getNode());
@ -1523,7 +1538,7 @@ JX.install('DiffChangesetList', {
var options = { var options = {
filter: 'comment', filter: 'comment',
wrap: true, wrap: true,
attribute: 'unsubmitted' attribute: 'anyDraft'
}; };
this._onjumpkey(1, options); this._onjumpkey(1, options);

View file

@ -31,6 +31,7 @@ JX.install('DiffInline', {
_isCollapsed: false, _isCollapsed: false,
_isDraft: null, _isDraft: null,
_isDraftDone: null,
_isFixed: null, _isFixed: null,
_isEditing: false, _isEditing: false,
_isNew: false, _isNew: false,
@ -73,6 +74,7 @@ JX.install('DiffInline', {
this._isFixed = data.isFixed; this._isFixed = data.isFixed;
this._isGhost = data.isGhost; this._isGhost = data.isGhost;
this._isSynthetic = data.isSynthetic; this._isSynthetic = data.isSynthetic;
this._isDraftDone = data.isDraftDone;
this._changesetID = data.changesetID; this._changesetID = data.changesetID;
this._isNew = false; this._isNew = false;
@ -103,6 +105,10 @@ JX.install('DiffInline', {
return this._isSynthetic; return this._isSynthetic;
}, },
isDraftDone: function() {
return this._isDraftDone;
},
bindToRange: function(data) { bindToRange: function(data) {
this._displaySide = data.displaySide; this._displaySide = data.displaySide;
this._number = parseInt(data.number, 10); this._number = parseInt(data.number, 10);
@ -321,6 +327,7 @@ JX.install('DiffInline', {
JX.DOM.alterClass(comment, 'inline-state-is-draft', response.draftState); JX.DOM.alterClass(comment, 'inline-state-is-draft', response.draftState);
this._isFixed = response.isChecked; this._isFixed = response.isChecked;
this._isDraftDone = !!response.draftState;
this._didUpdate(); this._didUpdate();
}, },