commit 21b5ccb8aae3224794082fc768a08a55716c40ad Author: Ben Rohlfs Date: Tue Oct 6 14:51:38 2020 +0200 Fix the dangling comma after reviewer on dashboard We cannot hide the comma based on simple css :last-of-type, because we also have to take the additional reviewers into account. And from a css perspective we cannot be sure about their presence, because :last-of-type does not care about display:none being present or not. Change-Id: I6d2da48da83584a961b1b660a1ea94f8693ad57d diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.ts index 20cc207..5a345f2 100644 --- a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.ts +++ b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.ts @@ -408,6 +408,16 @@ export class GrChangeListItem extends ChangeTableMixin( isOwner: selfId === ownerId, }); } + + _computeCommaHidden(index?: number, change?: ChangeInfo) { + if (index === undefined) return false; + if (change === undefined) return false; + + const additionalCount = this._computeAdditionalReviewersCount(change); + const primaryCount = this._computePrimaryReviewers(change).length; + const isLast = index === primaryCount - 1; + return isLast && additionalCount === 0; + } } declare global { diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_html.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_html.ts index 5316fe5..497ed1e 100644 --- a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_html.ts +++ b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_html.ts @@ -113,9 +113,6 @@ export const htmlTemplate = html` .cell.label iron-icon { vertical-align: top; } - .lastChildHidden:last-of-type { - display: none; - } @media only screen and (max-width: 50em) { :host { display: flex; @@ -197,6 +194,7 @@ export const htmlTemplate = html` is="dom-repeat" items="[[_computePrimaryReviewers(change)]]" as="reviewer" + indexAs="index" > + >