From 6135b5bed44177bbaa29f23f7a9e4f43639a8ae1 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Wed, 11 Oct 2023 11:25:08 +0900 Subject: [PATCH] Fix ability for non-owners to change team visibility (#385) This fixes #384 * Hides "Change party visibility" button when a user is viewing an unlisted team they did not create * Prevents updating team at all if the `editable` flag is not set (which might break something else for anonymous teams... we'll see) --- components/party/Party/index.tsx | 2 +- components/party/PartyHeader/index.tsx | 36 ++++++++++++++------------ 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/components/party/Party/index.tsx b/components/party/Party/index.tsx index 58998e08..eb553641 100644 --- a/components/party/Party/index.tsx +++ b/components/party/Party/index.tsx @@ -143,7 +143,7 @@ const Party = (props: Props) => { // Methods: Updating the party's details async function updateDetails(details: DetailsObject) { if (!props.team) return await createParty(details) - else return await updateParty(details) + else if (party.editable) return await updateParty(details) } function formatDetailsObject(details: DetailsObject) { diff --git a/components/party/PartyHeader/index.tsx b/components/party/PartyHeader/index.tsx index f113ed64..0da39d23 100644 --- a/components/party/PartyHeader/index.tsx +++ b/components/party/PartyHeader/index.tsx @@ -345,13 +345,15 @@ const PartyHeader = (props: Props) => { text={t('party.notices.buttons.copy_link')} onClick={copyToClipboard} /> -