Skip to content

Commit

Permalink
Fix some typings
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan committed Mar 10, 2023
1 parent 09b0d25 commit 599586c
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion apps/meteor/app/settings/client/lib/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Settings extends SettingsBase {

dict = new ReactiveDict('settings');

get<TValue extends EJSONableProperty>(_id: string | RegExp, ...args: []): TValue | undefined {
get<TValue extends EJSONableProperty = any>(_id: string | RegExp, ...args: []): TValue | undefined {
if (_id instanceof RegExp) {
throw new Error('RegExp Settings.get(RegExp)');
}
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/ui-login/client/username/username.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Template.username.onCreated(function () {
const accountsCustomFields = settings.get('Accounts_CustomFields');
if (typeof accountsCustomFields === 'string' && accountsCustomFields.trim() !== '') {
try {
return this.customFields.set(JSON.parse(settings.get('Accounts_CustomFields')));
return this.customFields.set(JSON.parse(settings.get('Accounts_CustomFields') ?? 'null'));
} catch (error1) {
return console.error('Invalid JSON for Accounts_CustomFields');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ export const formattingButtons: ReadonlyArray<FormattingButton> = [
}
},
link: 'https://khan.github.io/KaTeX/function-support.html',
condition: () => settings.get('Katex_Enabled'),
condition: () => settings.get('Katex_Enabled') ?? false,
},
] as const;
2 changes: 1 addition & 1 deletion apps/meteor/client/lib/rooms/roomCoordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class RoomCoordinatorClient extends RoomCoordinator {
return false;
}
if (isRoomFederated(room)) {
return settings.get('Federation_Matrix_enabled');
return settings.get('Federation_Matrix_enabled') ?? false;
}
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/lib/utils/fireGlobalEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const fireGlobalEvent = (eventName: string, detail?: unknown): void => {
eventName,
data: detail,
},
settings.get('Iframe_Integration_send_target_origin'),
settings.get('Iframe_Integration_send_target_origin') ?? '/',
);
}
});
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/startup/actionButtons/webdavUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Meteor.startup(() => {
return false;
}

return settings.get('Webdav_Integration_Enabled');
return settings.get('Webdav_Integration_Enabled') ?? false;
},
action(_, props) {
const { message = messageArgs(this).msg } = props;
Expand Down
7 changes: 4 additions & 3 deletions apps/meteor/client/views/account/sidebarItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@ export const {
href: 'profile',
i18nLabel: 'Profile',
icon: 'user',
permissionGranted: (): boolean => settings.get('Accounts_AllowUserProfileChange'),
permissionGranted: (): boolean => settings.get('Accounts_AllowUserProfileChange') ?? false,
},
{
href: 'security',
i18nLabel: 'Security',
icon: 'lock',
permissionGranted: (): boolean => settings.get('Accounts_TwoFactorAuthentication_Enabled') || settings.get('E2E_Enable'),
permissionGranted: (): boolean =>
(settings.get('Accounts_TwoFactorAuthentication_Enabled') ?? false) || (settings.get('E2E_Enable') ?? false),
},
{
href: 'integrations',
i18nLabel: 'Integrations',
icon: 'code',
permissionGranted: (): boolean => settings.get('Webdav_Integration_Enabled'),
permissionGranted: (): boolean => settings.get('Webdav_Integration_Enabled') ?? false,
},
{
href: 'tokens',
Expand Down

0 comments on commit 599586c

Please sign in to comment.