From dcd72ef7e11c0ed0b5ce4975e393b14e1760b727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 19 Oct 2012 17:49:56 +0200 Subject: [PATCH] Properly handle suspended status in JS and fix "you" --- file/js/be.bastelstu.WCF.Chat.coffee | 6 ++++++ file/lib/page/ChatMessagePage.class.php | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/file/js/be.bastelstu.WCF.Chat.coffee b/file/js/be.bastelstu.WCF.Chat.coffee index 874a905..775c86e 100644 --- a/file/js/be.bastelstu.WCF.Chat.coffee +++ b/file/js/be.bastelstu.WCF.Chat.coffee @@ -356,6 +356,11 @@ window.console ?= element.removeClass 'timsChatAway' element.removeAttr 'title' element.data 'tooltip', '' + if user.suspended + element.addClass 'suspended' + else + element.removeClass 'suspended' + $('#timsChatUserList').append element # Insert the user else @@ -365,6 +370,7 @@ window.console ?= li.addClass 'timsChatUser' li.addClass 'jsTooltip' li.addClass 'you' if user.userID is WCF.User.userID + li.addClass 'suspended' if user.suspended if user.awayStatus? li.addClass 'timsChatAway' li.attr 'title', user.awayStatus diff --git a/file/lib/page/ChatMessagePage.class.php b/file/lib/page/ChatMessagePage.class.php index 7b7948b..ed0eb17 100644 --- a/file/lib/page/ChatMessagePage.class.php +++ b/file/lib/page/ChatMessagePage.class.php @@ -159,10 +159,10 @@ public function show() { } foreach ($this->users as $user) { $json['users'][] = array( - 'userID' => $user->userID, + 'userID' => (int) $user->userID, 'username' => $user->username, 'awayStatus' => $user->awayStatus, - 'suspended' => !$this->room->canWrite($user) + 'suspended' => (boolean) !$this->room->canWrite($user) ); }