File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
notification-preferences/data Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 11import { getConfig } from '@edx/frontend-platform' ;
22
3+ import { parseEnvBoolean } from '../../utils' ;
4+
35export const notificationChannels = ( ) => ( {
46 WEB : 'web' ,
5- ...( getConfig ( ) . SHOW_PUSH_CHANNEL && { PUSH : 'push' } ) ,
6- ...( getConfig ( ) . SHOW_EMAIL_CHANNEL && { EMAIL : 'email' } ) ,
7+ ...( parseEnvBoolean ( getConfig ( ) . SHOW_PUSH_CHANNEL ) && { PUSH : 'push' } ) ,
8+ ...( parseEnvBoolean ( getConfig ( ) . SHOW_EMAIL_CHANNEL ) && { EMAIL : 'email' } ) ,
79} ) ;
810
911export const shouldHideAppPreferences = ( preferences , appId ) => {
Original file line number Diff line number Diff line change @@ -38,3 +38,13 @@ export function getMostRecentApprovedOrPendingVerifiedName(verifiedNames) {
3838
3939 return applicableName ;
4040}
41+
42+ /**
43+ * Parse an environment variable string value to a boolean.
44+ * @param {string } value the environment variable string value
45+ * @returns {boolean } the parsed boolean value
46+ */
47+ export const parseEnvBoolean = ( value ) => {
48+ if ( ! value ) { return false ; }
49+ return String ( value ) . toLowerCase ( ) === 'true' ;
50+ } ;
You can’t perform that action at this time.
0 commit comments