Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Fix httpd-client patch review verdict schema
Rūdolfs Ošiņš committed 3 years ago
commit 3a4a766cfad66629766565e4c67878c03b556501
parent 67f02463eed9105f84107bec66afbcc7fba35aa0
4 files changed +26 -16
modified httpd-client/lib/project/patch.ts
@@ -72,14 +72,14 @@ const codeCommentSchema = strictObject({
type Verdict = "accept" | "reject";

export interface Review {
-
  verdict?: Verdict;
+
  verdict?: Verdict | null;
  comment?: string;
  inline: CodeComment[];
  timestamp: number;
}

const reviewSchema = strictObject({
-
  verdict: optional(union([literal("accept"), literal("reject")])),
+
  verdict: optional(union([literal("accept"), literal("reject")])).nullable(),
  comment: optional(string()),
  inline: array(codeCommentSchema),
  timestamp: number(),
modified src/views/projects/Issues.svelte
@@ -15,12 +15,13 @@
  import { HttpdClient } from "@httpd-client";
  import { sessionStore } from "@app/lib/session";

+
  import Button from "@app/components/Button.svelte";
+
  import ErrorMessage from "@app/components/ErrorMessage.svelte";
  import HeaderToggleLabel from "@app/views/projects/HeaderToggleLabel.svelte";
  import IssueTeaser from "@app/views/projects/Issue/IssueTeaser.svelte";
+
  import Loading from "@app/components/Loading.svelte";
  import Placeholder from "@app/components/Placeholder.svelte";
  import TabBar from "@app/components/TabBar.svelte";
-
  import Loading from "@app/components/Loading.svelte";
-
  import Button from "@app/components/Button.svelte";

  export let projectId: string;
  export let state: IssueStatus;
@@ -161,10 +162,14 @@
          <IssueTeaser {issue} />
        </div>
      {:else}
-
        <Placeholder emoji="🍂">
-
          <div slot="title">{capitalize(state)} issues</div>
-
          <div slot="body">No issues matched the current filter</div>
-
        </Placeholder>
+
        {#if error}
+
          <ErrorMessage message="Couldn't load issues." stackTrace={error} />
+
        {:else}
+
          <Placeholder emoji="🍂">
+
            <div slot="title">{capitalize(state)} issues</div>
+
            <div slot="body">No issues matched the current filter</div>
+
          </Placeholder>
+
        {/if}
      {/each}
      <div class="more">
        {#if loading}
modified src/views/projects/Patch.svelte
@@ -100,7 +100,7 @@
    }
  }

-
  function formatVerdict(verdict?: string) {
+
  function formatVerdict(verdict?: string | null) {
    switch (verdict) {
      case "accept":
        return "accepted this revision";
modified src/views/projects/Patches.svelte
@@ -9,14 +9,15 @@
  import type { BaseUrl } from "@httpd-client";

  import * as router from "@app/lib/router";
+
  import capitalize from "lodash/capitalize";
  import { HttpdClient } from "@httpd-client";

+
  import Button from "@app/components/Button.svelte";
+
  import ErrorMessage from "@app/components/ErrorMessage.svelte";
+
  import Loading from "@app/components/Loading.svelte";
  import PatchTeaser from "./Patch/PatchTeaser.svelte";
  import Placeholder from "@app/components/Placeholder.svelte";
-
  import capitalize from "lodash/capitalize";
  import TabBar from "@app/components/TabBar.svelte";
-
  import Loading from "@app/components/Loading.svelte";
-
  import Button from "@app/components/Button.svelte";

  export let projectId: string;
  export let state: PatchStatus;
@@ -140,10 +141,14 @@
          <PatchTeaser {baseUrl} {projectId} {patch} />
        </div>
      {:else}
-
        <Placeholder emoji="🍂">
-
          <div slot="title">{capitalize(state)} patches</div>
-
          <div slot="body">No patches matched the current filter</div>
-
        </Placeholder>
+
        {#if error}
+
          <ErrorMessage message="Couldn't load patches." stackTrace={error} />
+
        {:else}
+
          <Placeholder emoji="🍂">
+
            <div slot="title">{capitalize(state)} patches</div>
+
            <div slot="body">No patches matched the current filter</div>
+
          </Placeholder>
+
        {/if}
      {/each}
      <div class="more">
        {#if loading}