From 94633dbc97ab9597b77a4db7f10a15cbde7a0c9d Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Sat, 17 Sep 2022 03:56:25 +0100 Subject: [PATCH] Add visual indicator that an organisation is public --- chartered-frontend/src/types/organisations.ts | 2 ++ chartered-web/src/endpoints/web_api/organisations/info.rs | 2 ++ chartered-web/src/endpoints/web_api/organisations/list.rs | 2 ++ chartered-frontend/src/routes/(authed)/crates/[organisation]/+page.svelte | 11 +++++++++++ chartered-frontend/src/routes/(authed)/organisations/list/+page.svelte | 10 ++++++++++ 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/chartered-frontend/src/types/organisations.ts b/chartered-frontend/src/types/organisations.ts index 2c9ff78..9a3bc91 100644 --- a/chartered-frontend/src/types/organisations.ts +++ a/chartered-frontend/src/types/organisations.ts @@ -5,11 +5,13 @@ export interface OrganisationListItem { name: string; description: string; + public: boolean; } export interface OrganisationDetail { description: string; crates: OrganisationCrate[]; + public: boolean; } export interface OrganisationCrate { diff --git a/chartered-web/src/endpoints/web_api/organisations/info.rs b/chartered-web/src/endpoints/web_api/organisations/info.rs index 828557f..af2fdac 100644 --- a/chartered-web/src/endpoints/web_api/organisations/info.rs +++ a/chartered-web/src/endpoints/web_api/organisations/info.rs @@ -51,6 +51,7 @@ permissions: can_manage_users.then(|| perms), }) .collect(), + public: organisation.organisation().public, })) } @@ -61,6 +62,7 @@ implied_permissions: Option<&'static [[UserPermission; 2]]>, crates: Vec, members: Vec, + public: bool, } #[derive(Serialize)] diff --git a/chartered-web/src/endpoints/web_api/organisations/list.rs b/chartered-web/src/endpoints/web_api/organisations/list.rs index ddc0922..df3f54d 100644 --- a/chartered-web/src/endpoints/web_api/organisations/list.rs +++ a/chartered-web/src/endpoints/web_api/organisations/list.rs @@ -19,6 +19,7 @@ .map(|v| ResponseOrganisation { name: v.name, description: v.description, + public: v.public, }) .collect(), })) @@ -33,6 +34,7 @@ pub struct ResponseOrganisation { name: String, description: String, + public: bool, } #[derive(Error, Debug)] diff --git a/chartered-frontend/src/routes/(authed)/crates/[organisation]/+page.svelte b/chartered-frontend/src/routes/(authed)/crates/[organisation]/+page.svelte index 9ae9ab6..8882946 100644 --- a/chartered-frontend/src/routes/(authed)/crates/[organisation]/+page.svelte +++ a/chartered-frontend/src/routes/(authed)/crates/[organisation]/+page.svelte @@ -91,8 +91,15 @@
-

- {$page.params.organisation} +

+ {$page.params.organisation} + {#await organisationPromise then organisation} + {#if organisation.public} + + + + {/if} + {/await}

diff --git a/chartered-frontend/src/routes/(authed)/organisations/list/+page.svelte b/chartered-frontend/src/routes/(authed)/organisations/list/+page.svelte index 41484f9..98e058b 100644 --- a/chartered-frontend/src/routes/(authed)/organisations/list/+page.svelte +++ a/chartered-frontend/src/routes/(authed)/organisations/list/+page.svelte @@ -1,7 +1,8 @@