Disable chat for anonymous users

This commit is contained in:
James Allen 2014-07-21 11:56:49 +01:00
parent 088d27f22b
commit 4151f5d85f
4 changed files with 6 additions and 3 deletions

View file

@ -62,7 +62,7 @@ block content
include ./editor/publish-template include ./editor/publish-template
include ./editor/dropbox include ./editor/dropbox
.ui-layout-east .ui-layout-east(ng-if="!anonymous")
include ./editor/chat include ./editor/chat
script(type="text/ng-template", id="genericMessageModalTemplate") script(type="text/ng-template", id="genericMessageModalTemplate")
@ -86,6 +86,7 @@ block content
window.userSettings = !{JSON.stringify(userSettings).replace(/\//g, '\\/')}; window.userSettings = !{JSON.stringify(userSettings).replace(/\//g, '\\/')};
window.user = !{JSON.stringify(user).replace(/\//g, '\\/')}; window.user = !{JSON.stringify(user).replace(/\//g, '\\/')};
window.csrfToken = "!{csrfToken}"; window.csrfToken = "!{csrfToken}";
window.anonymous = #{anonymous};
window.requirejs = { window.requirejs = {
"paths" : { "paths" : {
"mathjax": "https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML", "mathjax": "https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML",

View file

@ -78,7 +78,8 @@ header.toolbar.toolbar-header(ng-cloak, ng-hide="state.loading")
tooltip-placement="bottom", tooltip-placement="bottom",
ng-class="{ active: ui.chatOpen }", ng-class="{ active: ui.chatOpen }",
ng-click="toggleChat()", ng-click="toggleChat()",
ng-controller="ChatButtonController" ng-controller="ChatButtonController",
ng-show="!anonymous"
) )
i.fa.fa-fw.fa-comment( i.fa.fa-fw.fa-comment(
ng-class="{ 'bounce': unreadMessages > 0 }" ng-class="{ 'bounce': unreadMessages > 0 }"

View file

@ -53,6 +53,7 @@ define [
} }
$scope.user = window.user $scope.user = window.user
$scope.settings = window.userSettings $scope.settings = window.userSettings
$scope.anonymous = window.anonymous
$scope.chat = {} $scope.chat = {}

View file

@ -80,7 +80,7 @@ define [
resetOpenStates = () -> resetOpenStates = () ->
state = element.layout().readState() state = element.layout().readState()
if attrs.openEast? if attrs.openEast? and state.east?
openEast = $parse(attrs.openEast) openEast = $parse(attrs.openEast)
openEast.assign(scope, !state.east.initClosed) openEast.assign(scope, !state.east.initClosed)