Skip to content

A platform for community discussion. Free, open, simple.

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

Kelv74aeec8ea3df
diff --git a/app/assets/javascripts/discourse/app/lib/can-check-emails-helper.js b/app/assets/javascripts/discourse/app/lib/can-check-emails-helper.js
index 91be0e897e2..656cbe66cd9 100644
--- a/app/assets/javascripts/discourse/app/lib/can-check-emails-helper.js
+++ b/app/assets/javascripts/discourse/app/lib/can-check-emails-helper.js
@@ -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
);