зеркало из https://github.com/nextcloud/spreed.git
Unify the names of join/leave room vs. remove*FromRoom
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Родитель
44431df952
Коммит
d5b0d39ef3
|
@ -239,7 +239,7 @@ return [
|
|||
],
|
||||
],
|
||||
[
|
||||
'name' => 'Room#exitRoom',
|
||||
'name' => 'Room#leaveRoom',
|
||||
'url' => '/api/{apiVersion}/room/{token}/participants/active',
|
||||
'verb' => 'DELETE',
|
||||
'requirements' => [
|
||||
|
|
|
@ -1040,7 +1040,7 @@ video {
|
|||
#app-sidebar .participantWithList {
|
||||
overflow-y: auto;
|
||||
/* Add room for the popovermenu on last user */
|
||||
padding-bottom: 50px;
|
||||
padding-bottom: 64px;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
'<li>'+
|
||||
'<button class="leave-room-button">'+
|
||||
'<span class="{{#if isDeletable}}icon-close{{else}}icon-delete{{/if}}"></span>'+
|
||||
'<span>'+t('spreed', 'Leave room')+'</span>'+
|
||||
'<span>'+t('spreed', 'Remove room from list')+'</span>'+
|
||||
'</button>'+
|
||||
'</li>'+
|
||||
'{{#if isDeletable}}'+
|
||||
|
@ -99,7 +99,7 @@
|
|||
templateContext: function() {
|
||||
return {
|
||||
isDeletable: (this.model.get('participantType') === 1 || this.model.get('participantType') === 2) &&
|
||||
(Object.keys(this.model.get('participants')).length > 2 || this.model.get('numGuests') > 0)
|
||||
(Object.keys(this.model.get('participants')).length > 1 || this.model.get('numGuests') > 0)
|
||||
};
|
||||
},
|
||||
onRender: function() {
|
||||
|
|
|
@ -86,8 +86,8 @@ class Application extends App {
|
|||
$messages->addMessageForAllParticipants($room, 'refresh-participant-list');
|
||||
};
|
||||
|
||||
$dispatcher->addListener(Room::class . '::postUserEnterRoom', $listener);
|
||||
$dispatcher->addListener(Room::class . '::postGuestEnterRoom', $listener);
|
||||
$dispatcher->addListener(Room::class . '::postJoinRoom', $listener);
|
||||
$dispatcher->addListener(Room::class . '::postJoinRoomGuest', $listener);
|
||||
$dispatcher->addListener(Room::class . '::postRemoveUser', $listener);
|
||||
$dispatcher->addListener(Room::class . '::postRemoveBySession', $listener);
|
||||
$dispatcher->addListener(Room::class . '::postUserDisconnectRoom', $listener);
|
||||
|
|
|
@ -805,13 +805,13 @@ class RoomController extends OCSController {
|
|||
try {
|
||||
if ($this->userId !== null) {
|
||||
$sessionIds = $this->manager->getSessionIdsForUser($this->userId);
|
||||
$newSessionId = $room->enterRoomAsUser($this->userId, $password, $this->session->get('spreed-password') === $room->getToken());
|
||||
$newSessionId = $room->joinRoom($this->userId, $password, $this->session->get('spreed-password') === $room->getToken());
|
||||
|
||||
if (!empty($sessionIds)) {
|
||||
$this->messages->deleteMessages($sessionIds);
|
||||
}
|
||||
} else {
|
||||
$newSessionId = $room->enterRoomAsGuest($password, $this->session->get('spreed-password') === $room->getToken());
|
||||
$newSessionId = $room->joinRoomGuest($password, $this->session->get('spreed-password') === $room->getToken());
|
||||
}
|
||||
} catch (InvalidPasswordException $e) {
|
||||
return new DataResponse([], Http::STATUS_FORBIDDEN);
|
||||
|
@ -833,7 +833,7 @@ class RoomController extends OCSController {
|
|||
* @param string $token
|
||||
* @return DataResponse
|
||||
*/
|
||||
public function exitRoom($token) {
|
||||
public function leaveRoom($token) {
|
||||
$sessionId = $this->session->get('spreed-session');
|
||||
$this->session->remove('spreed-session');
|
||||
|
||||
|
@ -845,7 +845,7 @@ class RoomController extends OCSController {
|
|||
$room->removeParticipantBySession($participant);
|
||||
} else {
|
||||
$participant = $room->getParticipant($this->userId);
|
||||
$room->disconnectUserFromAllRooms($participant->getUser());
|
||||
$room->leaveRoom($participant->getUser());
|
||||
}
|
||||
} catch (RoomNotFoundException $e) {
|
||||
} catch (ParticipantNotFoundException $e) {
|
||||
|
|
14
lib/Room.php
14
lib/Room.php
|
@ -502,8 +502,8 @@ class Room {
|
|||
* @return string
|
||||
* @throws InvalidPasswordException
|
||||
*/
|
||||
public function enterRoomAsUser($userId, $password, $passedPasswordProtection = false) {
|
||||
$this->dispatcher->dispatch(self::class . '::preUserEnterRoom', new GenericEvent($this));
|
||||
public function joinRoom($userId, $password, $passedPasswordProtection = false) {
|
||||
$this->dispatcher->dispatch(self::class . '::preJoinRoom', new GenericEvent($this));
|
||||
|
||||
$this->disconnectUserFromAllRooms($userId);
|
||||
|
||||
|
@ -536,7 +536,7 @@ class Room {
|
|||
$query->execute();
|
||||
}
|
||||
|
||||
$this->dispatcher->dispatch(self::class . '::postUserEnterRoom', new GenericEvent($this));
|
||||
$this->dispatcher->dispatch(self::class . '::postJoinRoom', new GenericEvent($this));
|
||||
|
||||
return $sessionId;
|
||||
}
|
||||
|
@ -544,7 +544,7 @@ class Room {
|
|||
/**
|
||||
* @param string $userId
|
||||
*/
|
||||
public function disconnectUserFromAllRooms($userId) {
|
||||
public function leaveRoom($userId) {
|
||||
$this->dispatcher->dispatch(self::class . '::preUserDisconnectRoom', new GenericEvent($this));
|
||||
|
||||
// Reset sessions on all normal rooms
|
||||
|
@ -572,8 +572,8 @@ class Room {
|
|||
* @return string
|
||||
* @throws InvalidPasswordException
|
||||
*/
|
||||
public function enterRoomAsGuest($password, $passedPasswordProtection = false) {
|
||||
$this->dispatcher->dispatch(self::class . '::preGuestEnterRoom', new GenericEvent($this));
|
||||
public function joinRoomGuest($password, $passedPasswordProtection = false) {
|
||||
$this->dispatcher->dispatch(self::class . '::preJoinRoomGuest', new GenericEvent($this));
|
||||
|
||||
if (!$passedPasswordProtection && !$this->verifyPassword($password)) {
|
||||
throw new InvalidPasswordException();
|
||||
|
@ -590,7 +590,7 @@ class Room {
|
|||
$sessionId = $this->secureRandom->generate(255);
|
||||
}
|
||||
|
||||
$this->dispatcher->dispatch(self::class . '::postGuestEnterRoom', new GenericEvent($this));
|
||||
$this->dispatcher->dispatch(self::class . '::postJoinRoomGuest', new GenericEvent($this));
|
||||
|
||||
return $sessionId;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче