mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06: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) {
|
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);
|
this._addSubscribed(channelProxy);
|
||||||
const channelName = channelProxy.name;
|
const channelName = channelProxy.name;
|
||||||
let state = this._presenceChannelStates[channelName];
|
let state = this._presenceChannelStates[channelName];
|
||||||
|
Loading…
Reference in New Issue
Block a user