Merge "Add undefined check to changeIsOpen"

This commit is contained in:
Ben Rohlfs
2019-07-10 20:20:50 +00:00
committed by Gerrit Code Review
6 changed files with 8 additions and 8 deletions

View File

@@ -123,8 +123,8 @@ limitations under the License.
return this.getBaseUrl() + '/c/' + changeNum;
},
changeIsOpen(status) {
return status === this.ChangeStatus.NEW;
changeIsOpen(change) {
return change && change.status === this.ChangeStatus.NEW;
},
/**

View File

@@ -238,7 +238,7 @@
_computeItemNeedsReview(account, change, showReviewedState) {
return showReviewedState && !change.reviewed &&
!change.work_in_progress &&
this.changeIsOpen(change.status) &&
this.changeIsOpen(change) &&
(!account || account._account_id != change.owner._account_id);
},

View File

@@ -249,7 +249,7 @@
if (!draftSection || !draftSection.results.length) { return; }
const closedChanges = draftSection.results
.filter(change => !this.changeIsOpen(change.status));
.filter(change => !this.changeIsOpen(change));
if (!closedChanges.length) { return; }
this._showDraftsBanner = true;

View File

@@ -592,7 +592,7 @@
if (editPatchsetLoaded) {
// Only show actions that mutate an edit if an actual edit patch set
// is loaded.
if (this.changeIsOpen(this.change.status)) {
if (this.changeIsOpen(this.change)) {
if (editBasedOnCurrentPatchSet) {
if (!this.actions.publishEdit) {
this.set('actions.publishEdit', PUBLISH_EDIT);
@@ -614,7 +614,7 @@
this._deleteAndNotify('deleteEdit');
}
if (this.changeIsOpen(this.change.status)) {
if (this.changeIsOpen(this.change)) {
// Only show edit button if there is no edit patchset loaded and the
// file list is not in edit mode.
if (editPatchsetLoaded || editMode) {

View File

@@ -177,7 +177,7 @@
},
_computeHideStrategy(change) {
return !this.changeIsOpen(change.status);
return !this.changeIsOpen(change);
},
/**

View File

@@ -121,7 +121,7 @@
];
// Get conflicts if change is open and is mergeable.
if (this.changeIsOpen(this.change.status) && this.mergeable) {
if (this.changeIsOpen(this.change) && this.mergeable) {
promises.push(this._getConflicts().then(response => {
// Because the server doesn't always return a response and the
// template expects an array, always return an array.