From a73f5c4581a9ee24d987b4ca94d1959cce72b97d Mon Sep 17 00:00:00 2001 From: Allan Lasser Date: Mon, 25 Nov 2024 11:05:53 -0500 Subject: [PATCH] Hide empty collaborators on public projects --- .../components/projects/Collaborators.svelte | 170 +++++++++--------- .../(app)/projects/[id]-[slug]/+page.ts | 1 - 2 files changed, 86 insertions(+), 85 deletions(-) diff --git a/src/lib/components/projects/Collaborators.svelte b/src/lib/components/projects/Collaborators.svelte index 71e5ab38d..734024c88 100644 --- a/src/lib/components/projects/Collaborators.svelte +++ b/src/lib/components/projects/Collaborators.svelte @@ -86,94 +86,96 @@ } - - - - {$_("projects.collaborators.title")} - - - - {#if project.add_remove_access} - - {/if} - - - {#each Object.entries(group(sort(users))) as [key, members]} - {#if members.length} -
-

{$_(accessLabels[key])}

-
- {/if} - {#each members as user} - {#if isProjectUser || project.edit_access} - - - {getUserName(user.user)} - - {#if project.add_remove_access && !isMe(user, $me)} - - - - - - - {/if} - - - {:else} - - - {getUserName(user.user)} - - {/if} - {/each} - {:else} - - {$_("projects.collaborators.empty")} +{#if users.length > 0 || project.add_remove_access} + + + + {$_("projects.collaborators.title")} + + + {#if project.add_remove_access} - (show = "invite")}> + + {/if} + + + {#each Object.entries(group(sort(users))) as [key, members]} + {#if members.length} +
+

{$_(accessLabels[key])}

+
{/if} -
- {/each} -
+ {#each members as user} + {#if isProjectUser || project.edit_access} + + + {getUserName(user.user)} + + {#if project.add_remove_access && !isMe(user, $me)} + + + + + + + {/if} + + + {:else} + + + {getUserName(user.user)} + + {/if} + {/each} + {:else} + + {$_("projects.collaborators.empty")} + {#if project.add_remove_access} + (show = "invite")}> + {$_("projects.collaborators.add")} + + {/if} + + {/each} + +{/if} -{#if show} +{#if show && project.add_remove_access}

{actions[show]}

diff --git a/src/routes/(app)/projects/[id]-[slug]/+page.ts b/src/routes/(app)/projects/[id]-[slug]/+page.ts index d94c03a4c..578166830 100644 --- a/src/routes/(app)/projects/[id]-[slug]/+page.ts +++ b/src/routes/(app)/projects/[id]-[slug]/+page.ts @@ -12,7 +12,6 @@ import * as projects from "$lib/api/projects"; import * as collaborators from "$lib/api/collaborators"; import { search } from "$lib/api/documents"; import { breadcrumbTrail } from "$lib/utils/navigation"; -import { getPinnedAddons } from "$lib/api/addons"; export async function load({ params, url, parent, data, fetch }) { const id = parseInt(params.id, 10);