зеркало из https://github.com/nextcloud/spreed.git
Include "publishingPermissions" in participant messages of signaling
This will allow the clients to react to "publishingPermissions" changes directly from the signaling messages, without needing to fetch again the participants (although they may need to fetch them again nevertheless for UI updates). The internal signaling server also needs to listen to changes on the property to be able to know when to send the message (the external signaling server already listened to the changes to be able to update the permission flags internally). Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Родитель
da5d51ecc8
Коммит
4009de75a2
|
@ -399,6 +399,7 @@ class SignalingController extends OCSController {
|
|||
'lastPing' => $session->getLastPing(),
|
||||
'sessionId' => $session->getSessionId(),
|
||||
'inCall' => $session->getInCall(),
|
||||
'publishingPermissions' => $participant->getAttendee()->getPublishingPermissions(),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -264,6 +264,7 @@ class BackendNotifier {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => '0',
|
||||
'participantType' => $attendee->getParticipantType(),
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_NONE,
|
||||
];
|
||||
if ($attendee->getActorType() === Attendee::ACTOR_USERS) {
|
||||
$data['userId'] = $attendee->getActorId();
|
||||
|
@ -274,6 +275,7 @@ class BackendNotifier {
|
|||
$data['inCall'] = $session->getInCall();
|
||||
$data['lastPing'] = $session->getLastPing();
|
||||
$data['sessionId'] = $session->getSessionId();
|
||||
$data['publishingPermissions'] = $attendee->getPublishingPermissions();
|
||||
$users[] = $data;
|
||||
|
||||
if (\in_array($session->getSessionId(), $sessionIds, true)) {
|
||||
|
|
|
@ -83,6 +83,7 @@ class Listener {
|
|||
$dispatcher->addListener(Room::EVENT_BEFORE_USER_REMOVE, $listener);
|
||||
$dispatcher->addListener(Room::EVENT_BEFORE_PARTICIPANT_REMOVE, $listener);
|
||||
$dispatcher->addListener(Room::EVENT_BEFORE_ROOM_DISCONNECT, $listener);
|
||||
$dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_PUBLISHING_PERMISSIONS_SET, $listener);
|
||||
|
||||
$listener = static function (RoomEvent $event) {
|
||||
$room = $event->getRoom();
|
||||
|
|
|
@ -27,6 +27,7 @@ use OCA\Talk\Chat\CommentsManager;
|
|||
use OCA\Talk\Config;
|
||||
use OCA\Talk\Events\SignalingRoomPropertiesEvent;
|
||||
use OCA\Talk\Manager;
|
||||
use OCA\Talk\Model\Attendee;
|
||||
use OCA\Talk\Model\AttendeeMapper;
|
||||
use OCA\Talk\Model\SessionMapper;
|
||||
use OCA\Talk\Participant;
|
||||
|
@ -665,6 +666,7 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => $userSession,
|
||||
'participantType' => Participant::MODERATOR,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_ALL,
|
||||
'userId' => $this->userId,
|
||||
],
|
||||
],
|
||||
|
@ -674,6 +676,7 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => $userSession,
|
||||
'participantType' => Participant::MODERATOR,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_ALL,
|
||||
'userId' => $this->userId,
|
||||
],
|
||||
],
|
||||
|
@ -698,6 +701,7 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => $guestSession,
|
||||
'participantType' => Participant::GUEST_MODERATOR,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_ALL,
|
||||
],
|
||||
],
|
||||
'users' => [
|
||||
|
@ -706,6 +710,7 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => $userSession,
|
||||
'participantType' => Participant::MODERATOR,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_ALL,
|
||||
'userId' => $this->userId,
|
||||
],
|
||||
[
|
||||
|
@ -713,6 +718,7 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => $guestSession,
|
||||
'participantType' => Participant::GUEST_MODERATOR,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_ALL,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
@ -739,6 +745,7 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => $userSession,
|
||||
'participantType' => Participant::MODERATOR,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_ALL,
|
||||
'userId' => $this->userId,
|
||||
],
|
||||
[
|
||||
|
@ -746,6 +753,7 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => 0,
|
||||
'participantType' => Participant::MODERATOR,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_NONE,
|
||||
'userId' => $notJoinedUserId,
|
||||
],
|
||||
[
|
||||
|
@ -753,6 +761,7 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => $guestSession,
|
||||
'participantType' => Participant::GUEST_MODERATOR,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_ALL,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
@ -771,6 +780,7 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => $userSession,
|
||||
'participantType' => Participant::USER,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_ALL,
|
||||
'userId' => $this->userId,
|
||||
],
|
||||
],
|
||||
|
@ -780,6 +790,7 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => $userSession,
|
||||
'participantType' => Participant::USER,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_ALL,
|
||||
'userId' => $this->userId,
|
||||
],
|
||||
[
|
||||
|
@ -787,6 +798,7 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => 0,
|
||||
'participantType' => Participant::MODERATOR,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_NONE,
|
||||
'userId' => $notJoinedUserId,
|
||||
],
|
||||
[
|
||||
|
@ -794,6 +806,7 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => $guestSession,
|
||||
'participantType' => Participant::GUEST_MODERATOR,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_ALL,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
@ -812,6 +825,7 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => $guestSession,
|
||||
'participantType' => Participant::GUEST,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_ALL,
|
||||
],
|
||||
],
|
||||
'users' => [
|
||||
|
@ -820,6 +834,7 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => $userSession,
|
||||
'participantType' => Participant::USER,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_ALL,
|
||||
'userId' => $this->userId,
|
||||
],
|
||||
[
|
||||
|
@ -827,6 +842,7 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => 0,
|
||||
'participantType' => Participant::MODERATOR,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_NONE,
|
||||
'userId' => $notJoinedUserId,
|
||||
],
|
||||
[
|
||||
|
@ -834,6 +850,51 @@ class BackendNotifierTest extends \Test\TestCase {
|
|||
'lastPing' => 0,
|
||||
'sessionId' => $guestSession,
|
||||
'participantType' => Participant::GUEST,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_ALL,
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
$this->controller->clearRequests();
|
||||
$this->participantService->updatePublishingPermissions($room, $guestParticipant, Attendee::PUBLISHING_PERMISSIONS_NONE);
|
||||
|
||||
$this->assertMessageWasSent($room, [
|
||||
'type' => 'participants',
|
||||
'participants' => [
|
||||
'changed' => [
|
||||
[
|
||||
'permissions' => [],
|
||||
'inCall' => 0,
|
||||
'lastPing' => 0,
|
||||
'sessionId' => $guestSession,
|
||||
'participantType' => Participant::GUEST,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_NONE,
|
||||
],
|
||||
],
|
||||
'users' => [
|
||||
[
|
||||
'inCall' => 0,
|
||||
'lastPing' => 0,
|
||||
'sessionId' => $userSession,
|
||||
'participantType' => Participant::USER,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_ALL,
|
||||
'userId' => $this->userId,
|
||||
],
|
||||
[
|
||||
'inCall' => 0,
|
||||
'lastPing' => 0,
|
||||
'sessionId' => 0,
|
||||
'participantType' => Participant::MODERATOR,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_NONE,
|
||||
'userId' => $notJoinedUserId,
|
||||
],
|
||||
[
|
||||
'inCall' => 0,
|
||||
'lastPing' => 0,
|
||||
'sessionId' => $guestSession,
|
||||
'participantType' => Participant::GUEST,
|
||||
'publishingPermissions' => Attendee::PUBLISHING_PERMISSIONS_NONE,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
Загрузка…
Ссылка в новой задаче