Skip to content

Commit

Permalink
Add organization user deletion and leaving events to EventService
Browse files Browse the repository at this point in the history
  • Loading branch information
r-tome committed Oct 15, 2024
1 parent 7afc99d commit bddca38
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apps/web/src/app/core/event.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,20 @@ export class EventService {
this.getShortId(ev.organizationUserId),
);
break;
case EventType.OrganizationUser_Deleted:
msg = this.i18nService.t("deletedUserId", this.formatOrgUserId(ev));
humanReadableMsg = this.i18nService.t(

Check warning on line 335 in apps/web/src/app/core/event.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/core/event.service.ts#L334-L335

Added lines #L334 - L335 were not covered by tests
"deletedUserId",
this.getShortId(ev.organizationUserId),
);
break;

Check warning on line 339 in apps/web/src/app/core/event.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/core/event.service.ts#L339

Added line #L339 was not covered by tests
case EventType.OrganizationUser_Left:
msg = this.i18nService.t("userLeftOrganization", this.formatOrgUserId(ev));
humanReadableMsg = this.i18nService.t(

Check warning on line 342 in apps/web/src/app/core/event.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/core/event.service.ts#L341-L342

Added lines #L341 - L342 were not covered by tests
"userLeftOrganization",
this.getShortId(ev.organizationUserId),
);
break;

Check warning on line 346 in apps/web/src/app/core/event.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/core/event.service.ts#L346

Added line #L346 was not covered by tests
// Org
case EventType.Organization_Updated:
msg = humanReadableMsg = this.i18nService.t("editedOrgSettings");
Expand Down
18 changes: 18 additions & 0 deletions apps/web/src/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -9421,5 +9421,23 @@
},
"permanentlyDeleteAttachmentConfirmation": {
"message": "Are you sure you want to permanently delete this attachment?"
},
"deletedUserId": {
"message": "Deleted user $ID$ - an owner / admin deleted the user account",
"placeholders": {
"id": {
"content": "$1",
"example": "First 8 Character of a GUID"
}
}
},
"userLeftOrganization": {
"message": "User $ID$ left organization",
"placeholders": {
"id": {
"content": "$1",
"example": "First 8 Character of a GUID"
}
}
}
}
2 changes: 2 additions & 0 deletions libs/common/src/enums/event-type.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export enum EventType {
OrganizationUser_Restored = 1512,
OrganizationUser_ApprovedAuthRequest = 1513,
OrganizationUser_RejectedAuthRequest = 1514,
OrganizationUser_Deleted = 1515,
OrganizationUser_Left = 1516,

Organization_Updated = 1600,
Organization_PurgedVault = 1601,
Expand Down

0 comments on commit bddca38

Please sign in to comment.