diff --git a/src/webviews/apps/plus/focus/components/gk-pull-request-row.ts b/src/webviews/apps/plus/focus/components/gk-pull-request-row.ts index e46566f..39c6ac5 100644 --- a/src/webviews/apps/plus/focus/components/gk-pull-request-row.ts +++ b/src/webviews/apps/plus/focus/components/gk-pull-request-row.ts @@ -100,6 +100,32 @@ export class GkPullRequestRow extends LitElement { return `indicator-${fromDateRange(this.lastUpdatedDate).status}`; } + get participants() { + const participants: { member: PullRequestMember; roles: string[] }[] = []; + function addMember(member: PullRequestMember, role: string) { + const participant = participants.find(p => p.member.name === member.name); + if (participant != null) { + participant.roles.push(role); + } else { + participants.push({ member: member, roles: [role] }); + } + } + + if (this.pullRequest?.author != null) { + addMember(this.pullRequest.author, 'author'); + } + + if (this.pullRequest?.assignees != null) { + this.pullRequest.assignees.forEach(m => addMember(m, 'assigned')); + } + + if (this.pullRequest?.reviewRequests != null) { + this.pullRequest.reviewRequests.forEach(m => addMember(m.reviewer, 'reviewer')); + } + + return participants; + } + override render() { if (!this.pullRequest) return undefined; @@ -188,23 +214,17 @@ export class GkPullRequestRow extends LitElement { ${when( - this.pullRequest.author != null, - () => - html``, - )} - ${when( - this.assignees.length > 0, + this.participants.length > 0, () => html` ${repeat( - this.assignees, - item => item.url, + this.participants, + item => item.member.url, item => html``, )} `,