Pass Tenant in notif handler
MODIFY
src/async-task/tasks/ImportHelper.ts
src/async-task/tasks/ImportHelper.ts
@@ -167,7 +167,7 @@ export default class ImportHelper {
'/verify-email?VerificationToken=' + verificationToken + '&Email=' + user.email + '&ResetToken=' + resetHash;
// Send activate account link
await NotificationHandler.sendVerificationEmailUserImport(
- tenant.id,
+ tenant,
Utils.generateUUID(),
user,
{

MODIFY
src/notification/NotificationHandler.ts
src/notification/NotificationHandler.ts
@@ -495,11 +495,10 @@ export default class NotificationHandler {
}
}
- public static async sendVerificationEmailUserImport(tenantID: string, notificationID: string, user: User,
+ public static async sendVerificationEmailUserImport(tenant: Tenant, notificationID: string, user: User,
sourceData: VerificationEmailNotification): Promise<void> {
- if (tenantID !== Constants.DEFAULT_TENANT) {
+ if (tenant.id !== Constants.DEFAULT_TENANT) {
// Get the Tenant
- const tenant = await TenantStorage.getTenant(tenantID, { withLogo: true });
sourceData.tenantLogoURL = tenant.logo;
// For each Sources
for (const notificationSource of NotificationHandler.notificationSources) {
@@ -513,7 +512,7 @@ export default class NotificationHandler {
await notificationSource.notificationTask.sendVerificationEmailUserImport(
sourceData, user, tenant, NotificationSeverity.INFO);
} catch (error) {
- await Logging.logActionExceptionMessage(tenantID, ServerAction.VERIFICATION_EMAIL_USER_IMPORT, error);
+ await Logging.logActionExceptionMessage(tenant.id, ServerAction.VERIFICATION_EMAIL_USER_IMPORT, error);
}
}
}

MODIFY
src/server/ocpp/json/JsonCentralSystemServer.ts
src/server/ocpp/json/JsonCentralSystemServer.ts
@@ -207,12 +207,12 @@ export default class JsonCentralSystemServer extends CentralSystemServer {
// Check Json connection
if (wsWrapper.url.startsWith('/OCPP16')) {
// Create and Initialize WS Connection
- wsConnection = await this.checkAndReferenceWSConnection(WSServerProtocol.OCPP16, wsWrapper);
+ wsConnection = await this.checkAndKeepWSConnection(WSServerProtocol.OCPP16, wsWrapper);
}
// Check Rest connection
if (wsWrapper.url.startsWith('/REST')) {
// Create and Initialize WS Connection
- wsConnection = await this.checkAndReferenceWSConnection(WSServerProtocol.REST, wsWrapper);
+ wsConnection = await this.checkAndKeepWSConnection(WSServerProtocol.REST, wsWrapper);
}
if (!wsConnection) {
throw new BackendError({
@@ -229,7 +229,7 @@ export default class JsonCentralSystemServer extends CentralSystemServer {
}
}
- private async checkAndReferenceWSConnection(protocol: WSServerProtocol, wsWrapper: WSWrapper): Promise<WSConnection> {
+ private async checkAndKeepWSConnection(protocol: WSServerProtocol, wsWrapper: WSWrapper): Promise<WSConnection> {
let wsConnection: WSConnection;
let action: ServerAction;
// Set the protocol

Pass Tenant in notif handler