mirror of
https://github.com/discourse/discourse.git
synced 2025-03-03 09:49:42 +00:00
DEV: Raise error when anon subscribes to PresenceChannels on login_required sites
In this situation, messagebus and the server-side Presence endpoints are unavailable, so it's better to quit early in the JS
This commit is contained in:
parent
d43b77b56b
commit
edc1378aed
@ -389,6 +389,10 @@ export default class PresenceService extends Service {
|
||||
}
|
||||
|
||||
async _subscribe(channelProxy, initialData = null) {
|
||||
if (this.siteSettings.login_required && !this.currentUser) {
|
||||
throw "Presence is only available to authenticated users on login-required sites";
|
||||
}
|
||||
|
||||
this._addSubscribed(channelProxy);
|
||||
const channelName = channelProxy.name;
|
||||
let state = this._presenceChannelStates[channelName];
|
||||
|
Loading…
x
Reference in New Issue
Block a user