Simplify sidebar context boxes

Also starts removing features that relied on the web client handling
local httpd instances
This commit is contained in:
Sebastian Martinez
2024-07-02 12:49:35 +02:00
committed by Rūdolfs Ošiņš
parent e4b15e7254
commit b8171e3a3f
8 changed files with 158 additions and 368 deletions
+5 -2
View File
@@ -12,6 +12,7 @@ import type {
SuccessResponse,
CodeLocation,
Range,
SeedingPolicy,
DefaultSeedingPolicy,
} from "./lib/shared.js";
import type { Comment, Embed, Reaction } from "./lib/project/comment.js";
@@ -50,6 +51,7 @@ import { Fetcher } from "./lib/fetcher.js";
import {
nodeConfigSchema,
scopeSchema,
seedingPolicySchema,
successResponseSchema,
} from "./lib/shared.js";
@@ -85,6 +87,7 @@ export type {
Remote,
Review,
Revision,
SeedingPolicy,
TreeStats,
Tree,
Verdict,
@@ -211,14 +214,14 @@ export class HttpdClient {
public async getPoliciesById(
id: string,
options?: RequestOptions,
): Promise<NodePolicies["policy"][]> {
): Promise<SeedingPolicy> {
return this.#fetcher.fetchOk(
{
method: "GET",
path: `node/policies/repos/${id}`,
options,
},
array(nodePoliciesSchema.shape.policy),
seedingPolicySchema,
);
}
+12
View File
@@ -12,6 +12,18 @@ export const successResponseSchema = object({
export const scopeSchema = union([literal("followed"), literal("all")]);
export const seedingPolicySchema = union([
object({
policy: literal("block"),
}),
object({
policy: literal("allow"),
scope: scopeSchema,
}),
]);
export type SeedingPolicy = z.infer<typeof seedingPolicySchema>;
const defaultSeedingPolicySchema = union([
object({
default: literal("block"),