refactor(core): Rename EventRelay to EventService (no-changelog) (#10110)

This commit is contained in:
Iván Ovejero
2024-07-19 12:55:38 +02:00
committed by GitHub
parent 222a0862bd
commit aba1c64500
36 changed files with 203 additions and 195 deletions

View File

@@ -21,7 +21,7 @@ import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
import { NotFoundError } from '@/errors/response-errors/not-found.error';
import { UnprocessableRequestError } from '@/errors/response-errors/unprocessable.error';
import { UserRepository } from '@/databases/repositories/user.repository';
import { EventRelay } from '@/eventbus/event-relay.service';
import { EventService } from '@/eventbus/event.service';
@RestController()
export class PasswordResetController {
@@ -37,7 +37,7 @@ export class PasswordResetController {
private readonly license: License,
private readonly passwordUtility: PasswordUtility,
private readonly userRepository: UserRepository,
private readonly eventRelay: EventRelay,
private readonly eventService: EventService,
) {}
/**
@@ -125,7 +125,7 @@ export class PasswordResetController {
message_type: 'Reset password',
public_api: false,
});
this.eventRelay.emit('email-failed', { user, messageType: 'Reset password' });
this.eventService.emit('email-failed', { user, messageType: 'Reset password' });
if (error instanceof Error) {
throw new InternalServerError(`Please contact your administrator: ${error.message}`);
}
@@ -139,7 +139,7 @@ export class PasswordResetController {
});
void this.internalHooks.onUserPasswordResetRequestClick({ user });
this.eventRelay.emit('user-password-reset-request-click', { user });
this.eventService.emit('user-password-reset-request-click', { user });
}
/**
@@ -172,7 +172,7 @@ export class PasswordResetController {
this.logger.info('Reset-password token resolved successfully', { userId: user.id });
void this.internalHooks.onUserPasswordResetEmailClick({ user });
this.eventRelay.emit('user-password-reset-email-click', { user });
this.eventService.emit('user-password-reset-email-click', { user });
}
/**
@@ -216,7 +216,7 @@ export class PasswordResetController {
this.authService.issueCookie(res, user, req.browserId);
void this.internalHooks.onUserUpdate({ user, fields_changed: ['password'] });
this.eventRelay.emit('user-updated', { user, fieldsChanged: ['password'] });
this.eventService.emit('user-updated', { user, fieldsChanged: ['password'] });
// if this user used to be an LDAP users
const ldapIdentity = user?.authIdentities?.find((i) => i.providerType === 'ldap');
@@ -225,7 +225,7 @@ export class PasswordResetController {
user_type: 'email',
was_disabled_ldap_user: true,
});
this.eventRelay.emit('user-signed-up', { user });
this.eventService.emit('user-signed-up', { user });
}
await this.externalHooks.run('user.password.update', [user.email, passwordHash]);