From 2f013df4e151ea1aab0137b1cfdd894a617d9d2a Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 20 Nov 2023 21:58:08 +0100 Subject: [PATCH] Refactor CobHeader --- src/views/projects/Cob/CobHeader.svelte | 90 +------------- src/views/projects/Issue.svelte | 110 +++++++++++------ src/views/projects/Issue/New.svelte | 25 ++-- src/views/projects/Patch.svelte | 152 ++++++++++++------------ tests/e2e/project/issue.spec.ts | 65 +++------- tests/e2e/project/patch.spec.ts | 67 ++++------- 6 files changed, 209 insertions(+), 300 deletions(-) diff --git a/src/views/projects/Cob/CobHeader.svelte b/src/views/projects/Cob/CobHeader.svelte index 82c4c4c48..ed6f38e18 100644 --- a/src/views/projects/Cob/CobHeader.svelte +++ b/src/views/projects/Cob/CobHeader.svelte @@ -1,35 +1,7 @@ -
- {#if (editTitle && !preview && mode === "readWrite") || (!preview && mode === "readCreate")} -
- - {:else if title} -
-
- -
- {:else} - No title - {/if} - - {#if editTitle && id} -
- {#if mode === "readWrite"} - - - - { - dispatch("refresh"); - mode = "readOnly"; - }}> - - - {:else} - (mode = "readWrite")}> - - - {/if} -
- {/if} +
diff --git a/src/views/projects/Issue.svelte b/src/views/projects/Issue.svelte index 7af070c26..5951a1c8d 100644 --- a/src/views/projects/Issue.svelte +++ b/src/views/projects/Issue.svelte @@ -25,12 +25,14 @@ import Icon from "@app/components/Icon.svelte"; import IconButton from "@app/components/IconButton.svelte"; import IconSmall from "@app/components/IconSmall.svelte"; + import InlineMarkdown from "@app/components/InlineMarkdown.svelte"; import LabelInput from "./Cob/LabelInput.svelte"; import Layout from "./Layout.svelte"; import Markdown from "@app/components/Markdown.svelte"; import NodeId from "@app/components/NodeId.svelte"; import ReactionSelector from "@app/components/ReactionSelector.svelte"; import Reactions from "@app/components/Reactions.svelte"; + import TextInput from "@app/components/TextInput.svelte"; import ThreadComponent from "@app/components/Thread.svelte"; export let baseUrl: BaseUrl; @@ -192,7 +194,13 @@ } } - async function editTitle(sessionId: string, title: string) { + async function editIssue( + sessionId: string, + title: string, + id: string, + body: string, + embeds: Embed[], + ) { try { await api.project.updateIssue( project.id, @@ -200,12 +208,18 @@ { type: "edit", title }, sessionId, ); + await api.project.updateIssue( + project.id, + issue.id, + { type: "comment.edit", id, body, embeds }, + sessionId, + ); } catch (error) { if (error instanceof Error) { modal.show({ component: ErrorModal, props: { - title: "Issue title editing failed", + title: "Issue editing failed", subtitle: [ "There was an error while updating the issue.", "Check your radicle-httpd logs for details.", @@ -374,7 +388,7 @@ let assigneeState: State = "read"; let labelState: State = "read"; - let descriptionState: State = "read"; + let issueState: State = "read";