mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-15 19:30:38 +08:00
Tweak issue/patch validation rules
Patches - title: mandatory, body: optional. Issues - title and body: mandatory.
This commit is contained in:
@@ -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 />
|
||||
|
||||
@@ -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)}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)}
|
||||
|
||||
Reference in New Issue
Block a user