mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 06:10:44 +08:00
Add alias to project delegates and threshold
This commit is contained in:
@@ -55,8 +55,9 @@ const projectSchema = object({
|
||||
name: string(),
|
||||
description: string(),
|
||||
defaultBranch: string(),
|
||||
delegates: array(string()),
|
||||
delegates: array(object({ id: string(), alias: optional(string()) })),
|
||||
head: string(),
|
||||
threshold: number(),
|
||||
visibility: union([
|
||||
object({ type: literal("public") }),
|
||||
object({ type: literal("private"), allow: optional(array(string())) }),
|
||||
|
||||
@@ -91,7 +91,12 @@
|
||||
localProjects instanceof Error ||
|
||||
localProjects === undefined
|
||||
? localProjects
|
||||
: localProjects.filter(p => isDelegate(nodeId, p.project.delegates));
|
||||
: localProjects.filter(p =>
|
||||
isDelegate(
|
||||
nodeId,
|
||||
p.project.delegates.map(d => d.id),
|
||||
),
|
||||
);
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@@ -186,13 +191,13 @@
|
||||
<div class="project-grid">
|
||||
{#if filteredLocalProjects && !(filteredLocalProjects instanceof Error)}
|
||||
{#each filteredLocalProjects as projectInfo}
|
||||
{@const delegates = projectInfo.project.delegates.map(
|
||||
d => d.id,
|
||||
)}
|
||||
<ProjectCard
|
||||
{projectInfo}
|
||||
isSeeding={true}
|
||||
isDelegate={isDelegate(
|
||||
nodeId,
|
||||
projectInfo.project.delegates,
|
||||
) ?? false} />
|
||||
isDelegate={isDelegate(nodeId, delegates) ?? false} />
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
@@ -261,11 +266,11 @@
|
||||
<div class="project-grid">
|
||||
{#if preferredSeedProjects && !(preferredSeedProjects instanceof Error)}
|
||||
{#each preferredSeedProjects as projectInfo}
|
||||
{@const delegates = projectInfo.project.delegates.map(d => d.id)}
|
||||
<ProjectCard
|
||||
{projectInfo}
|
||||
isSeeding={isSeeding(projectInfo.project.id)}
|
||||
isDelegate={isDelegate(nodeId, projectInfo.project.delegates) ??
|
||||
false} />
|
||||
isDelegate={isDelegate(nodeId, delegates) ?? false} />
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
: isSeeding(projectInfo.project.id)}
|
||||
isDelegate={isDelegate(
|
||||
session?.publicKey,
|
||||
projectInfo.project.delegates,
|
||||
projectInfo.project.delegates.map(d => d.id),
|
||||
) ?? false} />
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
@@ -402,6 +402,7 @@
|
||||
issue.discussion[0].edits.length > 1
|
||||
? issue.discussion[0].edits.at(-1)
|
||||
: undefined;
|
||||
$: delegates = project.delegates.map(d => d.id);
|
||||
|
||||
type State = "read" | "edit" | "submit";
|
||||
|
||||
@@ -507,7 +508,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
<div style="display: flex; gap: 0.5rem;">
|
||||
{#if session && role.isDelegateOrAuthor(session.publicKey, project.delegates, issue.author.id) && issueState === "read"}
|
||||
{#if session && role.isDelegateOrAuthor(session.publicKey, delegates, issue.author.id) && issueState === "read"}
|
||||
<Button
|
||||
variant="outline"
|
||||
title="edit issue"
|
||||
@@ -518,7 +519,7 @@
|
||||
{/if}
|
||||
{#if issueState === "read"}
|
||||
<Share {baseUrl} />
|
||||
{#if session && role.isDelegateOrAuthor(session.publicKey, project.delegates, issue.author.id)}
|
||||
{#if session && role.isDelegateOrAuthor(session.publicKey, delegates, issue.author.id)}
|
||||
<CobStateButton
|
||||
items={items.filter(
|
||||
([, state]) => !isEqual(state, issue.state),
|
||||
@@ -645,7 +646,7 @@
|
||||
canEditComment={partial(
|
||||
role.isDelegateOrAuthor,
|
||||
session?.publicKey,
|
||||
project.delegates,
|
||||
delegates,
|
||||
)}
|
||||
editComment={$experimental &&
|
||||
session &&
|
||||
@@ -672,7 +673,7 @@
|
||||
submit={partial(createComment, session.id)} />
|
||||
<div
|
||||
style="display:flex; flex-direction: column; align-items: flex-start;">
|
||||
{#if role.isDelegateOrAuthor(session.publicKey, project.delegates, issue.author.id)}
|
||||
{#if role.isDelegateOrAuthor(session.publicKey, delegates, issue.author.id)}
|
||||
<div class="connector" />
|
||||
<CobStateButton
|
||||
items={items.filter(
|
||||
@@ -689,7 +690,7 @@
|
||||
<div class="metadata global-hide-on-mobile">
|
||||
<AssigneeInput
|
||||
locallyAuthenticated={Boolean(
|
||||
role.isDelegate(session?.publicKey, project.delegates),
|
||||
role.isDelegate(session?.publicKey, delegates),
|
||||
)}
|
||||
assignees={issue.assignees}
|
||||
submitInProgress={assigneeState === "submit"}
|
||||
@@ -706,7 +707,7 @@
|
||||
}} />
|
||||
<LabelInput
|
||||
locallyAuthenticated={Boolean(
|
||||
role.isDelegate(session?.publicKey, project.delegates),
|
||||
role.isDelegate(session?.publicKey, delegates),
|
||||
)}
|
||||
labels={issue.labels}
|
||||
submitInProgress={labelState === "submit"}
|
||||
|
||||
@@ -136,12 +136,16 @@
|
||||
<div class="metadata">
|
||||
<AssigneeInput
|
||||
locallyAuthenticated={session &&
|
||||
project.delegates.includes(`did:key:${session.publicKey}`)}
|
||||
project.delegates
|
||||
.map(d => d.id)
|
||||
.includes(`did:key:${session.publicKey}`)}
|
||||
on:save={({ detail: updatedAssignees }) =>
|
||||
(assignees = updatedAssignees)} />
|
||||
<LabelInput
|
||||
locallyAuthenticated={session &&
|
||||
project.delegates.includes(`did:key:${session.publicKey}`)}
|
||||
project.delegates
|
||||
.map(d => d.id)
|
||||
.includes(`did:key:${session.publicKey}`)}
|
||||
on:save={({ detail: updatedLabels }) => (labels = updatedLabels)} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -604,6 +604,7 @@
|
||||
})),
|
||||
].sort((a, b) => a.timestamp - b.timestamp),
|
||||
]);
|
||||
$: delegates = project.delegates.map(d => d.id);
|
||||
$: firstRevision = timelineTuple[0][0];
|
||||
$: latestRevision = patch.revisions[patch.revisions.length - 1];
|
||||
$: session =
|
||||
@@ -747,7 +748,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#if session && role.isDelegateOrAuthor(session.publicKey, project.delegates, patch.author.id) && patchState === "read"}
|
||||
{#if session && role.isDelegateOrAuthor(session.publicKey, delegates, patch.author.id) && patchState === "read"}
|
||||
<Button
|
||||
variant="outline"
|
||||
title="edit patch"
|
||||
@@ -758,7 +759,7 @@
|
||||
{/if}
|
||||
{#if patchState === "read"}
|
||||
<Share {baseUrl} />
|
||||
{#if session && role.isDelegateOrAuthor(session.publicKey, project.delegates, patch.author.id)}
|
||||
{#if session && role.isDelegateOrAuthor(session.publicKey, delegates, patch.author.id)}
|
||||
<CobStateButton
|
||||
items={items.filter(
|
||||
([, state]) => !isEqual(state, patch.state),
|
||||
@@ -1004,7 +1005,7 @@
|
||||
canEdit={partial(
|
||||
role.isDelegateOrAuthor,
|
||||
session?.publicKey,
|
||||
project.delegates,
|
||||
delegates,
|
||||
)}
|
||||
editRevision={$experimental &&
|
||||
session &&
|
||||
@@ -1040,7 +1041,7 @@
|
||||
session.id,
|
||||
revision.revisionId,
|
||||
)} />
|
||||
{#if role.isDelegateOrAuthor(session.publicKey, project.delegates, patch.author.id)}
|
||||
{#if role.isDelegateOrAuthor(session.publicKey, delegates, patch.author.id)}
|
||||
<div class="connector" />
|
||||
<div style="display: flex;">
|
||||
<CobStateButton
|
||||
@@ -1100,10 +1101,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<LabelInput
|
||||
locallyAuthenticated={role.isDelegate(
|
||||
session?.publicKey,
|
||||
project.delegates,
|
||||
)}
|
||||
locallyAuthenticated={role.isDelegate(session?.publicKey, delegates)}
|
||||
submitInProgress={labelState === "submit"}
|
||||
labels={patch.labels}
|
||||
on:save={async ({ detail: newLabels }) => {
|
||||
|
||||
Reference in New Issue
Block a user