From 12497c358399aa96e93794584371c63dd75e428f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 19 May 2012 21:37:15 +0200 Subject: [PATCH] Populate whether a user is suspended. --- file/lib/data/chat/room/ChatRoom.class.php | 21 +++++++++++++++------ file/lib/page/ChatMessagePage.class.php | 3 ++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/file/lib/data/chat/room/ChatRoom.class.php b/file/lib/data/chat/room/ChatRoom.class.php index 7934def..4b67297 100644 --- a/file/lib/data/chat/room/ChatRoom.class.php +++ b/file/lib/data/chat/room/ChatRoom.class.php @@ -166,22 +166,31 @@ public function getUsers() { $sql = "SELECT u.*, - s.fieldValue AS awayStatus + st.fieldValue AS awayStatus, + su.suspensionID AS suspended FROM wcf".WCF_N."_user u LEFT JOIN - wcf".WCF_N."_user_storage s + wcf".WCF_N."_user_storage st ON ( - u.userID = s.userID - AND s.field = ? - AND s.packageID = ? + u.userID = st.userID + AND st.field = ? + AND st.packageID = ? + ) + LEFT JOIN + wcf".WCF_N."_chat_suspension su + ON ( + u.userID = su.userID + AND ( su.roomID IS NULL + OR su.roomID = ?) + AND time > ? ) WHERE u.userID IN (".rtrim(str_repeat('?,', count($userIDs)), ',').") ORDER BY u.username ASC"; $stmt = WCF::getDB()->prepareStatement($sql); - array_unshift($userIDs, 'away', $packageID); + array_unshift($userIDs, 'away', $packageID, $this->roomID, TIME_NOW); $stmt->execute($userIDs); return $stmt->fetchObjects('\wcf\data\user\User'); diff --git a/file/lib/page/ChatMessagePage.class.php b/file/lib/page/ChatMessagePage.class.php index 8bf6805..1f821df 100644 --- a/file/lib/page/ChatMessagePage.class.php +++ b/file/lib/page/ChatMessagePage.class.php @@ -115,7 +115,8 @@ public function show() { $json['users'][] = array( 'userID' => $user->userID, 'username' => $user->username, - 'awayStatus' => $user->awayStatus + 'awayStatus' => $user->awayStatus, + 'suspended' => $user->suspended ); }