mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-16 11:50:42 +08:00
Try to fetch alias on AssigneeInput
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
<script lang="ts">
|
||||
import type { Author } from "@bindings/cob/Author";
|
||||
|
||||
import { authorForNodeId, parseNodeId } from "@app/lib/utils";
|
||||
import {
|
||||
authorForNodeId,
|
||||
parseNodeId,
|
||||
publicKeyFromDid,
|
||||
} from "@app/lib/utils";
|
||||
import { invoke } from "@app/lib/invoke";
|
||||
|
||||
import Icon from "@app/components/Icon.svelte";
|
||||
import NodeId from "@app/components/NodeId.svelte";
|
||||
@@ -11,12 +16,12 @@
|
||||
allowedToEdit: boolean;
|
||||
assignees: Author[];
|
||||
submitInProgress: boolean;
|
||||
save: (updatedAssignees: string[]) => void;
|
||||
save: (updatedAssignees: Author[]) => void;
|
||||
}
|
||||
|
||||
const {
|
||||
allowedToEdit = false,
|
||||
assignees,
|
||||
assignees = $bindable(),
|
||||
submitInProgress = false,
|
||||
save,
|
||||
}: Props = $props();
|
||||
@@ -64,11 +69,17 @@
|
||||
}
|
||||
});
|
||||
|
||||
function addAssignee() {
|
||||
async function addAssignee() {
|
||||
if (valid && assignee) {
|
||||
updatedAssignees = [...updatedAssignees, { did: assignee }];
|
||||
const alias = await invoke<string | null>("alias", {
|
||||
nid: publicKeyFromDid(assignee),
|
||||
});
|
||||
updatedAssignees = [
|
||||
...updatedAssignees,
|
||||
{ did: assignee, alias: alias ?? undefined },
|
||||
];
|
||||
inputValue = "";
|
||||
save($state.snapshot(updatedAssignees.map(x => x.did)));
|
||||
save($state.snapshot(updatedAssignees));
|
||||
showInput = false;
|
||||
}
|
||||
}
|
||||
@@ -77,7 +88,7 @@
|
||||
updatedAssignees = updatedAssignees.filter(
|
||||
({ did }) => did !== assignee.did,
|
||||
);
|
||||
save($state.snapshot(updatedAssignees.map(x => x.did)));
|
||||
save($state.snapshot(updatedAssignees));
|
||||
showInput = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import type { Author } from "@bindings/cob/Author";
|
||||
import type { Config } from "@bindings/config/Config";
|
||||
import type { Issue } from "@bindings/cob/issue/Issue";
|
||||
import type { RepoInfo } from "@bindings/repo/RepoInfo";
|
||||
@@ -41,7 +42,7 @@
|
||||
|
||||
const embeds: { name: string; content: string }[] = [];
|
||||
|
||||
let assignees: string[] = $state([]);
|
||||
let assignees: Author[] = $state([]);
|
||||
let labels: string[] = $state([]);
|
||||
|
||||
async function createIssue() {
|
||||
@@ -51,7 +52,7 @@
|
||||
title,
|
||||
description,
|
||||
labels: $state.snapshot(labels),
|
||||
assignees: $state.snapshot(assignees),
|
||||
assignees: $state.snapshot(assignees.map(a => a.did)),
|
||||
embeds,
|
||||
},
|
||||
opts: { announce: $nodeRunning && $announce },
|
||||
@@ -161,9 +162,7 @@
|
||||
<div class="metadata-section" style:flex="1">
|
||||
<AssigneeInput
|
||||
allowedToEdit={true}
|
||||
assignees={assignees.map(assignee => {
|
||||
return { did: assignee };
|
||||
})}
|
||||
bind:assignees
|
||||
submitInProgress={false}
|
||||
save={newAssignees => {
|
||||
assignees = newAssignees;
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function saveAssignees(assignees: string[]) {
|
||||
async function saveAssignees(assignees: Author[]) {
|
||||
try {
|
||||
assigneesSaveInProgress = true;
|
||||
await invoke("edit_issue", {
|
||||
@@ -111,7 +111,7 @@
|
||||
cobId: issue.id,
|
||||
action: {
|
||||
type: "assign",
|
||||
assignees,
|
||||
assignees: assignees.map(a => a.did),
|
||||
},
|
||||
opts: { announce: $nodeRunning && $announce },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user