From 35c9ea7637147c664d0a5ab2d08405c16665f4e6 Mon Sep 17 00:00:00 2001 From: Daniel Beardsley Date: Thu, 18 May 2023 17:21:47 -0700 Subject: [PATCH 1/2] Signatures: treat dev_block as out-of-date CR When you "dev_block" something, have that inject a "synthetic" but out-of-date CR signature in the UI. This means that a dev_block somewhat reserves a place for you to CR it in the future. Most dev_blocks come after a review and we generally presume that the dev blocker will come back and CR it after the requested changes have been made. Therefore, we now show a dev_block as an "inactive" CR. Also, move the typescript comment to the line it's referring to. Closes #193 --- frontend/src/pull-card/index.tsx | 2 +- frontend/src/pull.ts | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/frontend/src/pull-card/index.tsx b/frontend/src/pull-card/index.tsx index 5a64527e..43d006e7 100644 --- a/frontend/src/pull-card/index.tsx +++ b/frontend/src/pull-card/index.tsx @@ -196,9 +196,9 @@ const formatDate = (dateStr: string | null) => { return dateStr ? formatter.format(new Date(dateStr)) : null; }; -// eslint-disable-next-line @typescript-eslint/no-explicit-any function highlightOnChange( ref: RefObject, +// eslint-disable-next-line @typescript-eslint/no-explicit-any dependencies: Array ) { // Animate a highlight when pull.received_at changes diff --git a/frontend/src/pull.ts b/frontend/src/pull.ts index 581d73a7..9f5f872a 100644 --- a/frontend/src/pull.ts +++ b/frontend/src/pull.ts @@ -8,6 +8,7 @@ import { StatusState, CommentSource, SignatureGroup, + SignatureType, } from "./types"; export class Pull extends PullData { @@ -18,7 +19,8 @@ export class Pull extends PullData { super(); Object.assign(this, data); - this.cr_signatures = computeSignatures(data.status.allCR); + const syntheticCRs = this.getSyntheticCRSignatures(); + this.cr_signatures = computeSignatures(data.status.allCR.concat(syntheticCRs)); this.qa_signatures = computeSignatures(data.status.allQA); } @@ -91,6 +93,20 @@ export class Pull extends PullData { }); } + getSyntheticCRSignatures(): Signature[] { + // Treat dev_block sigs as out-of-date CRs in that they hold a place + // in the CR requirements. + return this.status.dev_block.map((devBlock) => { + return { + data: { + ...devBlock.data, + type: SignatureType.CR, + active: 0, + } + }; + }); + } + /** * Returns true if there are required CI statues OR if there are *any* CI * statuses From d9564f85898812f2ed7d8ae31f2360fa33f09968 Mon Sep 17 00:00:00 2001 From: Daniel Beardsley Date: Tue, 20 Jun 2023 09:58:15 -0700 Subject: [PATCH 2/2] dev blocks: render them as out-of-date CRs and QAs Since a dev block may be made by someone QAing or CRing, and will usually end up requiring further CR and QA by the same people, let's render a dev block as an out of date CR + QA. This change counts a block as a CR and QA as far as the leader board is concerned --- frontend/src/pull.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/frontend/src/pull.ts b/frontend/src/pull.ts index 9f5f872a..a1870d71 100644 --- a/frontend/src/pull.ts +++ b/frontend/src/pull.ts @@ -19,8 +19,11 @@ export class Pull extends PullData { super(); Object.assign(this, data); - const syntheticCRs = this.getSyntheticCRSignatures(); - this.cr_signatures = computeSignatures(data.status.allCR.concat(syntheticCRs)); + const syntheticCRs = this.getSyntheticSignatures(SignatureType.CR); + const syntheticQAs = this.getSyntheticSignatures(SignatureType.QA); + this.status.allCR = this.status.allCR.concat(syntheticCRs); + this.status.allQA = this.status.allQA.concat(syntheticQAs); + this.cr_signatures = computeSignatures(data.status.allCR); this.qa_signatures = computeSignatures(data.status.allQA); } @@ -93,14 +96,14 @@ export class Pull extends PullData { }); } - getSyntheticCRSignatures(): Signature[] { + getSyntheticSignatures(type: SignatureType): Signature[] { // Treat dev_block sigs as out-of-date CRs in that they hold a place // in the CR requirements. return this.status.dev_block.map((devBlock) => { return { data: { ...devBlock.data, - type: SignatureType.CR, + type, active: 0, } };