Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-10-21 16:33:16 +0300
committerJoas Schilling <coding@schilljs.com>2020-10-30 12:38:09 +0300
commitb76b92fb931748326974e95fbfd329812cd42f49 (patch)
tree5da8714054297ca2aeeef6a9a31c1db9235fdea1 /lib/Service
parent9fed7b6760d3ecaa27337a86a4cd74e2f173d8a6 (diff)
Fix creating conversations and adding participants
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Service')
-rw-r--r--lib/Service/ParticipantService.php15
-rw-r--r--lib/Service/RoomService.php13
2 files changed, 17 insertions, 11 deletions
diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php
index 79e61425b..17ee86dc5 100644
--- a/lib/Service/ParticipantService.php
+++ b/lib/Service/ParticipantService.php
@@ -112,10 +112,11 @@ class ParticipantService {
}
// User joining a public room, without being invited
- $this->addUsers($room, [
- 'userId' => $user->getUID(),
+ $this->addUsers($room, [[
+ 'actorType' => 'users',
+ 'actorId' => $user->getUID(),
'participantType' => Participant::USER_SELF_JOINED,
- ]);
+ ]]);
$attendee = $this->attendeeMapper->findByActor($room->getId(), 'users', $user->getUID());
}
@@ -181,9 +182,9 @@ class ParticipantService {
/**
* @param Room $room
- * @param array ...$participants
+ * @param array $participants
*/
- public function addUsers(Room $room, array ...$participants): void {
+ public function addUsers(Room $room, array $participants): void {
$event = new AddParticipantsEvent($room, $participants);
$this->dispatcher->dispatch(Room::EVENT_BEFORE_USERS_ADD, $event);
@@ -195,8 +196,8 @@ class ParticipantService {
foreach ($participants as $participant) {
$attendee = new Attendee();
$attendee->setRoomId($room->getId());
- $attendee->setActorType('users');
- $attendee->setActorId($participant['userId']);
+ $attendee->setActorType($participant['actorType']);
+ $attendee->setActorId($participant['actorId']);
$attendee->setParticipantType($participant['participantType'] ?? Participant::USER);
$attendee->setLastReadMessage($lastMessage);
$this->attendeeMapper->insert($attendee);
diff --git a/lib/Service/RoomService.php b/lib/Service/RoomService.php
index 4a1f5debd..c3fcec059 100644
--- a/lib/Service/RoomService.php
+++ b/lib/Service/RoomService.php
@@ -34,9 +34,13 @@ class RoomService {
/** @var Manager */
protected $manager;
+ /** @var ParticipantService */
+ protected $participantService;
- public function __construct(Manager $manager) {
+ public function __construct(Manager $manager,
+ ParticipantService $participantService) {
$this->manager = $manager;
+ $this->participantService = $participantService;
}
/**
@@ -113,10 +117,11 @@ class RoomService {
$room = $this->manager->createRoom($type, $name, $objectType, $objectId);
if ($owner instanceof IUser) {
- $room->addUsers([
- 'userId' => $owner->getUID(),
+ $this->participantService->addUsers($room, [[
+ 'actorType' => 'users',
+ 'actorId' => $owner->getUID(),
'participantType' => Participant::OWNER,
- ]);
+ ]]);
}
return $room;