mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 22:30:41 +08:00
desktop: Save embeds when editing a review summary
The summary editor allowed attaching files but never sent them, so the link ended up in the summary while the file never reached the COB. Verdict changes and task toggles also sent no embeds, which would drop them again once a summary has some.
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
fullFileLoader,
|
||||
gitStatusEntries,
|
||||
} from "@app/lib/diffText";
|
||||
import { embedMap } from "@app/lib/embeds";
|
||||
import { nodeRunning } from "@app/lib/events";
|
||||
import {
|
||||
cachedGetDiff,
|
||||
@@ -180,7 +181,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function saveSummary(newSummary: string) {
|
||||
async function saveSummary(newSummary: string, embeds: Embed[]) {
|
||||
try {
|
||||
savingSummary = true;
|
||||
await invoke("edit_patch", {
|
||||
@@ -192,6 +193,7 @@
|
||||
summary: newSummary,
|
||||
verdict: review.verdict,
|
||||
labels: review.labels,
|
||||
embeds,
|
||||
},
|
||||
opts: { announce: $nodeRunning && $announce },
|
||||
});
|
||||
@@ -241,6 +243,7 @@
|
||||
summary: review.summary ?? "",
|
||||
verdict,
|
||||
labels: review.labels,
|
||||
embeds: review.embeds,
|
||||
},
|
||||
opts: { announce: $nodeRunning && $announce },
|
||||
});
|
||||
@@ -957,11 +960,12 @@
|
||||
<ExtendedTextarea
|
||||
{rid}
|
||||
body={review.summary ?? ""}
|
||||
embeds={embedMap(review.embeds)}
|
||||
focus
|
||||
submitCaption={savingSummary ? "Saving…" : "Save"}
|
||||
disableSubmit={savingSummary}
|
||||
submit={async ({ comment }) => {
|
||||
await saveSummary(comment);
|
||||
submit={async ({ comment, embeds }) => {
|
||||
await saveSummary(comment, Array.from(embeds.values()));
|
||||
}}
|
||||
close={() => (editingSummary = false)} />
|
||||
</div>
|
||||
@@ -974,7 +978,7 @@
|
||||
content={review.summary ?? ""}
|
||||
toggleTaskItem={isOwnPublishedReview
|
||||
? async content => {
|
||||
await saveSummary(content);
|
||||
await saveSummary(content, review.embeds);
|
||||
}
|
||||
: undefined} />
|
||||
{:else}
|
||||
|
||||
@@ -606,6 +606,7 @@
|
||||
reviewId: string,
|
||||
summary: string,
|
||||
review: { verdict?: Verdict; labels?: string[] },
|
||||
embeds: Embed[],
|
||||
) {
|
||||
try {
|
||||
await invoke("edit_patch", {
|
||||
@@ -617,6 +618,7 @@
|
||||
summary,
|
||||
verdict: review.verdict,
|
||||
labels: review.labels ?? [],
|
||||
embeds,
|
||||
},
|
||||
opts: { announce: $nodeRunning && $announce },
|
||||
});
|
||||
@@ -1426,6 +1428,10 @@
|
||||
r => r.id === opId,
|
||||
)}
|
||||
{@const hasReviewComments = (reviewRecord?.comments?.length ?? 0) > 0}
|
||||
{@const reviewEmbeds =
|
||||
[revision, ...revisions]
|
||||
.flatMap(r => r.reviews ?? [])
|
||||
.find(r => r.id === opId)?.embeds ?? []}
|
||||
{@const reviewOp = data.op}
|
||||
<ReviewItem
|
||||
{rid}
|
||||
@@ -1436,7 +1442,7 @@
|
||||
toggleTaskItem={data.op.author.did ===
|
||||
didFromPublicKey(config.publicKey)
|
||||
? async summary => {
|
||||
await editReviewSummary(opId, summary, reviewOp);
|
||||
await editReviewSummary(opId, summary, reviewOp, reviewEmbeds);
|
||||
}
|
||||
: undefined}
|
||||
onViewFullReview={hasReviewComments
|
||||
|
||||
Reference in New Issue
Block a user