Merge changes I8c3b977a,I7a4d19d2
* changes:
Specify event detail type for show-alert events
Add option to dismiss new messages toast
diff --git a/polygerrit-ui/app/elements/change/gr-change-summary/gr-change-summary.ts b/polygerrit-ui/app/elements/change/gr-change-summary/gr-change-summary.ts
index b7fc421..6e99a7d 100644
--- a/polygerrit-ui/app/elements/change/gr-change-summary/gr-change-summary.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-summary/gr-change-summary.ts
@@ -237,9 +237,6 @@
/** What is the maximum number of expanded checks chips? */
const DETAILS_QUOTA = 3;
-/** What is the maximum number of links renderend within one chip? */
-const MAX_LINKS_PER_CHIP = 3;
-
@customElement('gr-change-summary')
export class GrChangeSummary extends GrLitElement {
private readonly newChangeSummaryUiEnabled = appContext.flagsService.isEnabled(
@@ -284,9 +281,11 @@
}
td.key {
padding-right: var(--spacing-l);
+ padding-bottom: var(--spacing-m);
}
td.value {
padding-right: var(--spacing-l);
+ padding-bottom: var(--spacing-m);
}
iron-icon.launch {
color: var(--gray-foreground);
@@ -331,15 +330,13 @@
if (runs.length <= this.detailsQuota) {
this.detailsQuota -= runs.length;
return runs.map(run => {
- const links = resultFilter(run)
+ const allLinks = resultFilter(run)
.reduce((links, result) => {
return links.concat(result.links ?? []);
}, [] as Link[])
- .filter(link => link.primary)
- .slice(0, MAX_LINKS_PER_CHIP);
- const count = resultFilter(run).length;
- const countText = count > 1 ? ` ${count}` : '';
- const text = `${run.checkName}${countText}`;
+ .filter(link => link.primary);
+ const links = allLinks.length === 1 ? allLinks : [];
+ const text = `${run.checkName}`;
return html`<gr-checks-chip
class="${icon}"
.icon="${icon}"
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
index c856f68..ca3161f 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
@@ -991,7 +991,8 @@
const notIsReviewerAndHasDraftOrLabel = (r: AccountInfo) =>
!(r._account_id === currentUser._account_id && (hasDrafts || hasVote));
reviewers.base
- .filter(r => r._pendingAdd && r._account_id)
+ .filter(r => r._account_id)
+ .filter(r => r._pendingAdd || (this.canBeStarted && isOwner))
.filter(notIsReviewerAndHasDraftOrLabel)
.forEach(r => newAttention.add(r._account_id!));
// Add owner and uploader, if someone else replies.
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.js b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.js
index 4547e53..2b92ca6 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.js
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.js
@@ -314,6 +314,39 @@
assert.sameMembers([...element._newAttentionSet], [2, 5]);
});
+ test('computeNewAttention when sending wip change for review', () => {
+ const reviewers = {base: [
+ {_account_id: 2},
+ {_account_id: 3},
+ ]};
+ const change = {
+ owner: {_account_id: 1},
+ status: 'NEW',
+ attention_set: {},
+ };
+ element.change = change;
+ element._reviewers = reviewers.base;
+ flush();
+
+ // For an active change there is no reason to add anyone to the set.
+ let user = {_account_id: 1};
+ element._computeNewAttention(user, reviewers, [], change, [], false);
+ assert.sameMembers([...element._newAttentionSet], []);
+
+ // If the change is "work in progress" and the owner sends a reply, then
+ // add all reviewers.
+ element.canBeStarted = true;
+ flush();
+ user = {_account_id: 1};
+ element._computeNewAttention(user, reviewers, [], change, [], false);
+ assert.sameMembers([...element._newAttentionSet], [2, 3]);
+
+ // ... but not when someone else replies.
+ user = {_account_id: 4};
+ element._computeNewAttention(user, reviewers, [], change, [], false);
+ assert.sameMembers([...element._newAttentionSet], []);
+ });
+
test('computeNewAttentionAccounts', () => {
element._reviewers = [
{_account_id: 123, display_name: 'Ernie'},