Skip to content

Commit

Permalink
Signatures: treat dev_block as out-of-date CR
Browse files Browse the repository at this point in the history
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
  • Loading branch information
danielbeardsley committed May 19, 2023
1 parent ede69be commit 35c9ea7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontend/src/pull-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLElement>,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
dependencies: Array<any>
) {
// Animate a highlight when pull.received_at changes
Expand Down
18 changes: 17 additions & 1 deletion frontend/src/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
StatusState,
CommentSource,
SignatureGroup,
SignatureType,
} from "./types";

export class Pull extends PullData {
Expand All @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 35c9ea7

Please sign in to comment.