mirror of
https://github.com/discourse/discourse.git
synced 2025-02-04 02:25:15 +08:00
FIX: handle null this.model when checking if component is for current user in CanCheckEmailsHelper (#30359)
This commit is contained in:
parent
07efdaa32a
commit
74aeec8ea3
|
@ -10,6 +10,7 @@ export default class CanCheckEmailsHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
get canCheckEmails() {
|
get canCheckEmails() {
|
||||||
|
// Anonymous users can't check emails
|
||||||
if (!this.currentUser) {
|
if (!this.currentUser) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +18,7 @@ export default class CanCheckEmailsHelper {
|
||||||
const canStaffCheckEmails =
|
const canStaffCheckEmails =
|
||||||
this.can_moderators_view_emails && this.currentUser.staff;
|
this.can_moderators_view_emails && this.currentUser.staff;
|
||||||
return (
|
return (
|
||||||
this.model.id === this.currentUser.id ||
|
this.model?.id === this.currentUser.id ||
|
||||||
this.canAdminCheckEmails ||
|
this.canAdminCheckEmails ||
|
||||||
canStaffCheckEmails
|
canStaffCheckEmails
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user