app/assets/javascripts/hyrax/app.js.erb in hyrax-2.0.0.beta2 vs app/assets/javascripts/hyrax/app.js.erb in hyrax-2.0.0.beta3
- old
+ new
@@ -86,9 +86,12 @@
new PermissionsControl($("#collection_permissions"), 'tmpl-collection-grant');
},
// ActionCable for user notifications. This is displayed in the navbar.
notifications: function() {
+ // Do not create a consumer if user is not logged in
+ if ($("meta[name='current-user']").length === 0)
+ return;
var consumer = ActionCable.createConsumer("<%= Hyrax::Engine.routes.url_helpers.notifications_endpoint_path %>");
consumer.subscriptions.create("Hyrax::NotificationsChannel", {
connected: function(data) {
this.perform("update_locale", { locale: $('html').attr('lang') });
},