mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 22:30:41 +08:00
Update patch state from proposed to open
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
+15
-1
@@ -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
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user