Skip to content

Commit

Permalink
Merge pull request #88 from H2-invent/bugfix/emptyRoomUser
Browse files Browse the repository at this point in the history
if there is now RoomsUser then an empty will be created
  • Loading branch information
holema authored Mar 13, 2021
2 parents d9dd4dd + 201aeff commit 1017c67
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Service/RoomService.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ public function __construct(TranslatorInterface $translator, EntityManagerInterf
function join(Rooms $room, User $user, $t, $userName)
{
$roomUser = $this->em->getRepository(RoomsUser::class)->findOneBy(array('user' => $user, 'room' => $room));

if(!$roomUser){
$roomUser = new RoomsUser();
}
if ($t === 'a') {
$type = 'jitsi-meet://';
} else {
Expand Down
5 changes: 4 additions & 1 deletion src/Twig/CheckRoomPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ public function getFunctions(): array
new TwigFunction('roomPermissions', [$this, 'roomPermissions']),
];
}
public function roomPermissions(User $user, Rooms $rooms):RoomsUser
public function roomPermissions(User $user, Rooms $rooms):?RoomsUser
{
$permissions = $this->em->getRepository(RoomsUser::class)->findOneBy(array('user'=>$user, 'room'=>$rooms));
if(!$permissions){
$permissions = new RoomsUser();
}
return $permissions;
}

Expand Down

0 comments on commit 1017c67

Please sign in to comment.