"Recently Used Devices" section is guarded by "canCheckEmails" which seems unexpected

As seen in:
https://github.com/discourse/discourse/blob/4eb54f08b29a13b2a5653a4df5050c1ca07d2190/app/assets/javascripts/discourse/templates/preferences/account.hbs#L165

The visibility of this section of Preferences > Account:

image

Seems to be guarded by the condition of whether the users can check their own emails. This is unexpected behavior to me as a plugin developer, because when I override the can_check_email value for that user, it also hides the Recently Used Devices, when this seemingly has nothing to do with email.


The use case here is that we have SSO enabled on our site, and I’d rather not have the email label show up at all, since it is confusing for our users due to the way we integrate with our main site, and also causes inconsistencies across our sites in how we display PII, so I want to hide the email label entirely from Preferences > Account. I do not want to hide the Recently Used Devices however, since this is useful information for users / admins, but I can’t do this without overriding the template / css hacks, since both the email label and this recently used devices section use the same guard.

It seems like it would make more sense if the guard was replaced with something like {{#if canCheckAuthTokens}}. (It can initially be aliased from canCheckEmails for a quick fix, just so plugin developers can differentiate between the two when overriding these values)


If it is intended that this section is hidden by canCheckEmails, would anyone be able to give the semantics here as to why that makes sense?

Thanks a lot!

5 Likes

I think canCheckEmails was used as a shortcut here because the permissions are the same.

That sounds like a good approach to me - would be #pr-welcome if you have the time to implement it.

2 Likes