summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLogan Hanks <logan@google.com>2018-09-26 21:11:26 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-09-26 21:11:26 +0000
commitec40775f90a7a26e35d9cb20c0a84b5b21534aa9 (patch)
tree9490d6f687653f8b055b2dabfdb7d6f0aa7c9cc5
parent649ce537fb74f96c8a611c8db59b2bd1d7832508 (diff)
parent566becaae794fd63feb6037bd103f66f41e197f6 (diff)
Merge "Add disableEdit flag to gr-change-view"
-rw-r--r--polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js16
-rw-r--r--polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.html14
-rw-r--r--polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html4
-rw-r--r--polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js4
4 files changed, 35 insertions, 3 deletions
diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js
index 6af94a1c25..60479e8100 100644
--- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js
+++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js
@@ -241,6 +241,10 @@
];
},
},
+ disableEdit: {
+ type: Boolean,
+ value: false,
+ },
_hasKnownChainState: {
type: Boolean,
value: false,
@@ -397,7 +401,7 @@
'_actionsChanged(actions.*, revisionActions.*, _additionalActions.*)',
'_changeChanged(change)',
'_editStatusChanged(editMode, editPatchsetLoaded, ' +
- 'editBasedOnCurrentPatchSet, actions.*, change.*)',
+ 'editBasedOnCurrentPatchSet, disableEdit, actions.*, change.*)',
],
listeners: {
@@ -575,7 +579,15 @@
},
_editStatusChanged(editMode, editPatchsetLoaded,
- editBasedOnCurrentPatchSet) {
+ editBasedOnCurrentPatchSet, disableEdit) {
+ if (disableEdit) {
+ this._deleteAndNotify('publishEdit');
+ this._deleteAndNotify('rebaseEdit');
+ this._deleteAndNotify('deleteEdit');
+ this._deleteAndNotify('stopEdit');
+ this._deleteAndNotify('edit');
+ return;
+ }
if (editPatchsetLoaded) {
// Only show actions that mutate an edit if an actual edit patch set
// is loaded.
diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.html b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.html
index 91b39deede..89d4f1f883 100644
--- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.html
+++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.html
@@ -439,6 +439,20 @@ limitations under the License.
});
suite('change edits', () => {
+ test('disableEdit', () => {
+ element.set('editMode', false);
+ element.set('editPatchsetLoaded', false);
+ element.change = {status: 'NEW'};
+ element.set('disableEdit', true);
+ flushAsynchronousOperations();
+
+ assert.isNotOk(element.$$('gr-button[data-action-key="publishEdit"]'));
+ assert.isNotOk(element.$$('gr-button[data-action-key="rebaseEdit"]'));
+ assert.isNotOk(element.$$('gr-button[data-action-key="deleteEdit"]'));
+ assert.isNotOk(element.$$('gr-button[data-action-key="edit"]'));
+ assert.isNotOk(element.$$('gr-button[data-action-key="stopEdit"]'));
+ });
+
test('shows confirm dialog for delete edit', () => {
element.set('editMode', true);
element.set('editPatchsetLoaded', true);
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html
index 461bfc402a..8885a6f933 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html
@@ -394,8 +394,10 @@ limitations under the License.
<span class="headerSubject">[[_change.subject]]</span>
</div><!-- end headerTitle -->
<div class="commitActions" hidden$="[[!_loggedIn]]">
- <gr-change-actions id="actions"
+ <gr-change-actions
+ id="actions"
change="[[_change]]"
+ disable-edit="[[disableEdit]]"
has-parent="[[hasParent]]"
actions="[[_change.actions]]"
revision-actions="[[_currentRevisionActions]]"
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js
index ebd72ad9da..4d54161419 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js
@@ -102,6 +102,10 @@
type: Object,
value() { return document.body; },
},
+ disableEdit: {
+ type: Boolean,
+ value: false,
+ },
_commentThreads: Array,
/** @type {?} */
_serverConfig: {