mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Implement maxUsers in RoomAction
This commit is contained in:
parent
f5edd74642
commit
48976d793b
@ -147,6 +147,7 @@ public function getRoomList() {
|
|||||||
'roomID' => (int) $room->roomID,
|
'roomID' => (int) $room->roomID,
|
||||||
'active' => $this->parameters['room'] && $room->roomID == $this->parameters['room']->roomID,
|
'active' => $this->parameters['room'] && $room->roomID == $this->parameters['room']->roomID,
|
||||||
'userCount' => count($room->getUsers()),
|
'userCount' => count($room->getUsers()),
|
||||||
|
'maxUsers' => (int) $room->maxUsers,
|
||||||
'permissions' => array(
|
'permissions' => array(
|
||||||
'canBan' => (boolean) $room->canBan(),
|
'canBan' => (boolean) $room->canBan(),
|
||||||
'canMute' => (boolean) $room->canMute()
|
'canMute' => (boolean) $room->canMute()
|
||||||
@ -169,6 +170,12 @@ public function validateJoin() {
|
|||||||
$room = RoomCache::getInstance()->getRoom($this->parameters['roomID']);
|
$room = RoomCache::getInstance()->getRoom($this->parameters['roomID']);
|
||||||
if ($room === null) throw new exception\UserInputException('roomID');
|
if ($room === null) throw new exception\UserInputException('roomID');
|
||||||
if (!$room->canEnter()) throw new exception\PermissionDeniedException();
|
if (!$room->canEnter()) throw new exception\PermissionDeniedException();
|
||||||
|
|
||||||
|
if ($room->maxUsers && count($room->getUsers()) >= $room->maxUsers) {
|
||||||
|
$errorMessage = WCF::getLanguage()->getDynamicVariable('chat.global.error.join.full', array('room' => $room));
|
||||||
|
|
||||||
|
throw new exception\UserInputException('room', $errorMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -260,6 +267,7 @@ public function join() {
|
|||||||
)),
|
)),
|
||||||
'roomID' => (int) $room->roomID,
|
'roomID' => (int) $room->roomID,
|
||||||
'userCount' => count($room->getUsers()),
|
'userCount' => count($room->getUsers()),
|
||||||
|
'maxUsers' => (int) $room->maxUsers,
|
||||||
'permissions' => array(
|
'permissions' => array(
|
||||||
'canBan' => (boolean) $room->canBan(),
|
'canBan' => (boolean) $room->canBan(),
|
||||||
'canMute' => (boolean) $room->canMute()
|
'canMute' => (boolean) $room->canMute()
|
||||||
|
Loading…
Reference in New Issue
Block a user