From 4151f5d85f41390b00bfee174f48f3a68f767563 Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 21 Jul 2014 11:56:49 +0100 Subject: [PATCH] Disable chat for anonymous users --- services/web/app/views/project/editor.jade | 3 ++- services/web/app/views/project/editor/header.jade | 3 ++- services/web/public/coffee/ide.coffee | 1 + services/web/public/coffee/ide/directives/layout.coffee | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/services/web/app/views/project/editor.jade b/services/web/app/views/project/editor.jade index f8c7311205..b46b491dd7 100644 --- a/services/web/app/views/project/editor.jade +++ b/services/web/app/views/project/editor.jade @@ -62,7 +62,7 @@ block content include ./editor/publish-template include ./editor/dropbox - .ui-layout-east + .ui-layout-east(ng-if="!anonymous") include ./editor/chat script(type="text/ng-template", id="genericMessageModalTemplate") @@ -86,6 +86,7 @@ block content window.userSettings = !{JSON.stringify(userSettings).replace(/\//g, '\\/')}; window.user = !{JSON.stringify(user).replace(/\//g, '\\/')}; window.csrfToken = "!{csrfToken}"; + window.anonymous = #{anonymous}; window.requirejs = { "paths" : { "mathjax": "https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML", diff --git a/services/web/app/views/project/editor/header.jade b/services/web/app/views/project/editor/header.jade index 5a3bd93dd1..a119c561db 100644 --- a/services/web/app/views/project/editor/header.jade +++ b/services/web/app/views/project/editor/header.jade @@ -78,7 +78,8 @@ header.toolbar.toolbar-header(ng-cloak, ng-hide="state.loading") tooltip-placement="bottom", ng-class="{ active: ui.chatOpen }", ng-click="toggleChat()", - ng-controller="ChatButtonController" + ng-controller="ChatButtonController", + ng-show="!anonymous" ) i.fa.fa-fw.fa-comment( ng-class="{ 'bounce': unreadMessages > 0 }" diff --git a/services/web/public/coffee/ide.coffee b/services/web/public/coffee/ide.coffee index 15983a05dd..2ea76ea57d 100644 --- a/services/web/public/coffee/ide.coffee +++ b/services/web/public/coffee/ide.coffee @@ -53,6 +53,7 @@ define [ } $scope.user = window.user $scope.settings = window.userSettings + $scope.anonymous = window.anonymous $scope.chat = {} diff --git a/services/web/public/coffee/ide/directives/layout.coffee b/services/web/public/coffee/ide/directives/layout.coffee index f67f5a61f4..0c798dc912 100644 --- a/services/web/public/coffee/ide/directives/layout.coffee +++ b/services/web/public/coffee/ide/directives/layout.coffee @@ -80,7 +80,7 @@ define [ resetOpenStates = () -> state = element.layout().readState() - if attrs.openEast? + if attrs.openEast? and state.east? openEast = $parse(attrs.openEast) openEast.assign(scope, !state.east.initClosed)