Show unresolved comments in the confirm submit dialog
Screenshot: https://imgur.com/a/q4yJosx
Change-Id: I4c0a0ca877b5c56f78e5b8844ac2f2db9cc7f13a
diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts
index 78c48f8..5089b95 100644
--- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts
@@ -114,6 +114,7 @@
getApprovalInfo,
getVotingRange,
} from '../../../utils/label-util';
+import {CommentThread} from '../../../utils/comment-util';
const ERR_BRANCH_EMPTY = 'The destination branch can’t be empty.';
const ERR_COMMIT_EMPTY = 'The commit message can’t be empty.';
@@ -442,6 +443,9 @@
@property({type: String})
_actionLoadingMessage = '';
+ @property({type: Array})
+ commentThreads: CommentThread[] = [];
+
@property({
type: Array,
computed:
diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_html.ts b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_html.ts
index 2bbfbbf..71500ac 100644
--- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_html.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_html.ts
@@ -216,6 +216,7 @@
action="[[_revisionSubmitAction]]"
on-cancel="_handleConfirmDialogCancel"
on-confirm="_handleSubmitConfirm"
+ comment-threads="[[commentThreads]]"
hidden=""
></gr-confirm-submit-dialog>
<gr-dialog
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_html.ts b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_html.ts
index 6b849cb..7a0e29a 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_html.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_html.ts
@@ -449,6 +449,7 @@
on-edit-tap="_handleEditTap"
on-stop-edit-tap="_handleStopEditTap"
on-download-tap="_handleOpenDownloadDialog"
+ comment-threads="[[_commentThreads]]"
></gr-change-actions>
</div>
<!-- end commit actions -->
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-submit-dialog/gr-confirm-submit-dialog.ts b/polygerrit-ui/app/elements/change/gr-confirm-submit-dialog/gr-confirm-submit-dialog.ts
index 6e2e595..45b61ae 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-submit-dialog/gr-confirm-submit-dialog.ts
+++ b/polygerrit-ui/app/elements/change/gr-confirm-submit-dialog/gr-confirm-submit-dialog.ts
@@ -20,6 +20,7 @@
import '../../plugins/gr-endpoint-decorator/gr-endpoint-decorator';
import '../../plugins/gr-endpoint-param/gr-endpoint-param';
import '../../../styles/shared-styles';
+import '../gr-thread-list/gr-thread-list';
import {GestureEventListeners} from '@polymer/polymer/lib/mixins/gesture-event-listeners';
import {LegacyElementMixin} from '@polymer/polymer/lib/legacy/legacy-element-mixin';
import {PolymerElement} from '@polymer/polymer/polymer-element';
@@ -28,6 +29,7 @@
import {ChangeInfo, ActionInfo} from '../../../types/common';
import {GrDialog} from '../../shared/gr-dialog/gr-dialog';
import {pluralize} from '../../../utils/string-util';
+import {CommentThread, isUnresolved} from '../../../utils/comment-util';
export interface GrConfirmSubmitDialog {
$: {
@@ -60,6 +62,9 @@
@property({type: Object})
action?: ActionInfo;
+ @property({type: Array})
+ commentThreads: CommentThread[] = [];
+
resetFocus() {
this.$.dialog.resetFocus();
}
@@ -72,6 +77,10 @@
);
}
+ _computeUnresolvedThreads(commentThreads: CommentThread[]) {
+ return commentThreads.filter(thread => isUnresolved(thread));
+ }
+
_computeUnresolvedCommentsWarning(change: ChangeInfo) {
const unresolvedCount = change.unresolved_comment_count;
if (!unresolvedCount) throw new Error('unresolved comments undefined or 0');
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-submit-dialog/gr-confirm-submit-dialog_html.ts b/polygerrit-ui/app/elements/change/gr-confirm-submit-dialog/gr-confirm-submit-dialog_html.ts
index 6c7b1c2..f62c5b82 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-submit-dialog/gr-confirm-submit-dialog_html.ts
+++ b/polygerrit-ui/app/elements/change/gr-confirm-submit-dialog/gr-confirm-submit-dialog_html.ts
@@ -67,6 +67,15 @@
></iron-icon>
[[_computeUnresolvedCommentsWarning(change)]]
</p>
+ <gr-thread-list
+ id="commentList"
+ threads="[[_computeUnresolvedThreads(commentThreads)]]"
+ change="[[change]]"
+ change-num="[[change._number]]"
+ logged-in="true"
+ hide-toggle-buttons
+ >
+ </gr-thread-list>
</template>
<template is="dom-if" if="[[_computeHasChangeEdit(change)]]">
<iron-icon