FIX: handle null this.model when checking if component is for current user in CanCheckEmailsHelper (#30359)

This commit is contained in:
Kelv
2024-12-19 09:54:43 +08:00
committed by GitHub
parent 07efdaa32a
commit 74aeec8ea3

View File

@@ -10,6 +10,7 @@ export default class CanCheckEmailsHelper {
}
get canCheckEmails() {
// Anonymous users can't check emails
if (!this.currentUser) {
return false;
}
@@ -17,7 +18,7 @@ export default class CanCheckEmailsHelper {
const canStaffCheckEmails =
this.can_moderators_view_emails && this.currentUser.staff;
return (
this.model.id === this.currentUser.id ||
this.model?.id === this.currentUser.id ||
this.canAdminCheckEmails ||
canStaffCheckEmails
);