Update patch state from proposed to open

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
Sebastian Martinez
2023-03-30 17:51:58 +02:00
parent 53c83c465a
commit 6a03ccef2d
7 changed files with 54 additions and 10 deletions
+15 -1
View File
@@ -58,9 +58,23 @@ export interface Merge {
export type PatchState =
| { status: "draft" }
| { status: "proposed" }
| { status: "open" }
| { status: "archived" };
export function groupPatches(patches: Patch[]): {
open: Patch[];
draft: Patch[];
archived: Patch[];
} {
return patches.reduce(
(acc, patch) => {
acc[patch.state.status].push(patch);
return acc;
},
{ open: [] as Patch[], draft: [] as Patch[], archived: [] as Patch[] },
);
}
export class Patch {
id: string;
author: Author;
+2 -2
View File
@@ -28,7 +28,7 @@ export interface ProjectInfo {
defaultBranch: string;
delegates: string[];
patches: {
proposed: number;
open: number;
draft: number;
archived: number;
};
@@ -134,7 +134,7 @@ export class Project implements ProjectInfo {
peers: Peer[];
branches: Branches;
patches: {
proposed: number;
open: number;
draft: number;
archived: number;
};