gristlabs_grist-core/app/server/lib/INotifier.ts
Jarosław Sadziński 03ead0d1ca (core) Adding a flag for the UI to check if emails are enabled
Summary:
Front-end code can now test if emails are enabled
and hide some parts of UI based on it.

Test Plan:
Only secondery text was hidden on add users dialog.
Tested manually.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Subscribers: georgegevoian

Differential Revision: https://phab.getgrist.com/D4221
2024-04-03 09:50:17 +02:00

22 lines
778 B
TypeScript

import {SendGridConfig, SendGridMail} from 'app/gen-server/lib/NotifierTypes';
export interface INotifier {
// for test purposes, check if any notifications are in progress
readonly testPending: boolean;
deleteUser(userId: number): Promise<void>;
// Intercept outgoing messages for test purposes.
// Return undefined if no notification system is available.
testSetSendMessageCallback(op: (body: SendGridMail, description: string) => Promise<void>): SendGridConfig|undefined;
}
/**
* A notifier that does nothing. Used when no email notifications are configured.
*/
export const EmptyNotifier: INotifier = {
get testPending() { return false; },
async deleteUser() { /* do nothing */ },
testSetSendMessageCallback() { return undefined; },
} as const;