File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { env } from '$env/dynamic/public' ;
2
+ import { get } from 'svelte/store' ;
3
+ import { user } from '$lib/stores/user' ;
4
+ import { organization } from '$lib/stores/organization' ;
2
5
3
6
export const PUBLIC_CONSOLE_FEATURE_FLAGS = env . PUBLIC_CONSOLE_FEATURE_FLAGS ?? '' ;
4
7
@@ -9,9 +12,19 @@ function setupFlag(name: string, _description: string) {
9
12
return true ;
10
13
}
11
14
12
- // TODO: Check team prefs
15
+ const userInstance = get ( user ) ;
16
+ const userPrefs = userInstance ?. prefs ?? { } ;
17
+ const userFlag = userPrefs [ `flags-${ name } ` ] ?? null ;
18
+ if ( userFlag ) {
19
+ return true ;
20
+ }
13
21
14
- // TODO: Check user prefs
22
+ const organizationInstance = get ( organization ) ;
23
+ const organizationPrefs = organizationInstance ?. prefs ?? { } ;
24
+ const organizationFlag = organizationPrefs [ `flags-${ name } ` ] ?? null ;
25
+ if ( organizationFlag ) {
26
+ return true ;
27
+ }
15
28
16
29
return false ;
17
30
}
You can’t perform that action at this time.
0 commit comments