Просмотр исходного кода

Disable chat for anonymous users

James Allen 12 лет назад
Родитель
Сommit
4151f5d85f

+ 2 - 1
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",

+ 2 - 1
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 }"

+ 1 - 0
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 = {}
 		

+ 1 - 1
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)