Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Tweak issue/patch validation rules
Rūdolfs Ošiņš committed 2 years ago
commit d4b246c72de7cd47034bff1cd2ce56b97f89d221
parent 6ff0d521652677d5844a67b27466ab32ed7956a5
4 files changed +13 -4
modified src/components/ExtendedTextarea.svelte
@@ -25,7 +25,10 @@
  export let body: string = "";
  export let embeds: Map<string, Embed> = new Map();
  export let submitInProgress: boolean = false;
-
  export let validateBody: boolean = true;
+
  export let disallowEmptyBody: boolean = false;
+
  export let isValid: () => boolean = () => {
+
    return true;
+
  };

  let preview: boolean = false;
  let selectionStart = 0;
@@ -178,7 +181,7 @@
    </Button>
    <Button
      styleBorderRadius="0"
-
      disabled={validateBody && !body}
+
      disabled={!isValid()}
      variant={preview ? "selected" : "not-selected"}
      on:click={() => {
        preview = true;
@@ -235,7 +238,9 @@
      </Button>
      <Button
        variant="secondary"
-
        disabled={(validateBody && !body) || submitInProgress}
+
        disabled={!isValid() ||
+
          submitInProgress ||
+
          (disallowEmptyBody && body.length === 0)}
        on:click={submit}>
        {#if submitInProgress}
          <Loading small noDelay />
modified src/views/projects/Issue.svelte
@@ -542,6 +542,8 @@
        <div slot="description">
          {#if issueState !== "read"}
            <ExtendedTextarea
+
              isValid={() => newTitle.length > 0}
+
              disallowEmptyBody
              rawPath={rawPath(project.head)}
              enableAttachments
              embeds={parseEmbedIntoMap(issue.discussion[0].embeds)}
modified src/views/projects/Issue/New.svelte
@@ -99,6 +99,8 @@
          <svelte:fragment slot="description">
            <ExtendedTextarea
              rawPath={rawPath(project.head)}
+
              disallowEmptyBody
+
              isValid={() => issueTitle.length > 0}
              enableAttachments
              submitCaption="Submit"
              placeholder="Write a description"
modified src/views/projects/Patch.svelte
@@ -766,7 +766,7 @@
          <div class="revision-description">
            {#if session && patchState !== "read" && latestEdit}
              <ExtendedTextarea
-
                validateBody={false}
+
                isValid={() => patch.title.length > 0}
                enableAttachments
                embeds={parseEmbedIntoMap(latestEdit.embeds)}
                rawPath={rawPath(patch.revisions[0].id)}