mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 09:36:44 +00:00
refactor(core): Decouple user events from internal hooks (no-changelog) (#10292)
This commit is contained in:
@@ -19,7 +19,6 @@ import { isSamlLicensedAndEnabled } from '@/sso/saml/samlHelpers';
|
||||
import { UserService } from '@/services/user.service';
|
||||
import { Logger } from '@/Logger';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
import { InternalHooks } from '@/InternalHooks';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { UserRepository } from '@/databases/repositories/user.repository';
|
||||
import { isApiEnabled } from '@/PublicApi';
|
||||
@@ -40,7 +39,6 @@ export class MeController {
|
||||
constructor(
|
||||
private readonly logger: Logger,
|
||||
private readonly externalHooks: ExternalHooks,
|
||||
private readonly internalHooks: InternalHooks,
|
||||
private readonly authService: AuthService,
|
||||
private readonly userService: UserService,
|
||||
private readonly passwordUtility: PasswordUtility,
|
||||
@@ -101,7 +99,6 @@ export class MeController {
|
||||
this.authService.issueCookie(res, user, req.browserId);
|
||||
|
||||
const fieldsChanged = Object.keys(payload);
|
||||
this.internalHooks.onUserUpdate({ user, fields_changed: fieldsChanged });
|
||||
this.eventService.emit('user-updated', { user, fieldsChanged });
|
||||
|
||||
const publicUser = await this.userService.toPublic(user);
|
||||
@@ -151,7 +148,6 @@ export class MeController {
|
||||
|
||||
this.authService.issueCookie(res, updatedUser, req.browserId);
|
||||
|
||||
this.internalHooks.onUserUpdate({ user: updatedUser, fields_changed: ['password'] });
|
||||
this.eventService.emit('user-updated', { user: updatedUser, fieldsChanged: ['password'] });
|
||||
|
||||
await this.externalHooks.run('user.password.update', [updatedUser.email, updatedUser.password]);
|
||||
@@ -186,7 +182,10 @@ export class MeController {
|
||||
|
||||
this.logger.info('User survey updated successfully', { userId: req.user.id });
|
||||
|
||||
this.internalHooks.onPersonalizationSurveySubmitted(req.user.id, personalizationAnswers);
|
||||
this.eventService.emit('user-submitted-personalization-survey', {
|
||||
userId: req.user.id,
|
||||
answers: personalizationAnswers,
|
||||
});
|
||||
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user