Skip to content

Commit 00b161f

Browse files
committed
Prevent editors from requesting beta access
1 parent 846d917 commit 00b161f

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

frontend/src/lib/i18n/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ it's done, you should see your project in FieldWorks Lite and be able to use it.
680680
"user_not_in_beta": "FieldWorks Lite is currently in a beta testing phase. \n\
681681
Only selected early access users can download Lexbox projects in FieldWorks Lite. \n\
682682
Click the button below to request to join the early access program. It may take a few days for us to respond.",
683+
"only_managers_can_request_beta": "Only project managers can request early access to FieldWorks Lite.",
683684
"request_beta_access": "Request early access to FieldWorks Lite",
684685
"access_request_sent": "Your request to join the early access program has been submitted",
685686
"already_in_beta": "You're already in the early access program",

frontend/src/routes/(authenticated)/wheresMyProject/+page.svelte

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import type { PageData } from './$types';
23
import { TitlePage } from '$lib/layout';
34
import t from '$lib/i18n';
45
import Markdown from 'svelte-exmarkdown';
@@ -7,9 +8,18 @@
78
import { page } from '$app/state';
89
import { _sendFWLiteBetaRequestEmail } from './+page';
910
import type { UUID } from 'crypto';
10-
import { SendFwLiteBetaRequestEmailResult } from '$lib/gql/generated/graphql';
11+
import { ProjectRole, SendFwLiteBetaRequestEmailResult } from '$lib/gql/generated/graphql';
1112
import { useNotifications } from '$lib/notify';
1213
14+
interface Props {
15+
data: PageData;
16+
}
17+
18+
const { data }: Props = $props();
19+
20+
const user = $derived(data.user);
21+
const managesProjects = $derived(user.isAdmin || user.projects.some(proj => proj.role === ProjectRole.Manager));
22+
1323
const { notifySuccess } = useNotifications();
1424
1525
let requesting = $state(false);
@@ -45,7 +55,10 @@
4555
{#snippet missingFlagContent()}
4656
<Markdown md={$t('where_is_my_project.user_not_in_beta')} />
4757
<div class="text-center">
48-
<Button loading={requesting} variant="btn-primary" onclick={requestBetaAccess}>{$t('where_is_my_project.request_beta_access')}</Button>
58+
<Button disabled={!managesProjects} loading={requesting} variant="btn-primary" onclick={requestBetaAccess}>{$t('where_is_my_project.request_beta_access')}</Button>
59+
{#if !managesProjects}
60+
<p class="mt-2 text-sm text-error">{$t('where_is_my_project.only_managers_can_request_beta')}</p>
61+
{/if}
4962
</div>
5063
{/snippet}
5164
</FeatureFlagAlternateContent>

0 commit comments

Comments
 (0)