File tree Expand file tree Collapse file tree 2 files changed +3
-11
lines changed
Expand file tree Collapse file tree 2 files changed +3
-11
lines changed Original file line number Diff line number Diff line change 3030#[Route('/room ' , format: 'json ' )]
3131class RoomController extends AbstractController
3232{
33- public const IS_GAME_MASTERED_ROOM = 'isGameMastered ' ;
33+ public const string IS_GAME_MASTERED_ROOM = 'isGameMastered ' ;
3434
3535 public function __construct (
3636 private readonly RoomRepository $ roomRepository ,
@@ -60,20 +60,16 @@ public function createRoom(Request $request): JsonResponse
6060 $ player ->setUser ($ user );
6161 $ player ->setRoom ($ room );
6262
63- // Check if this should be a game-mastered room
64- $ isGameMastered = false ;
6563 if ($ request ->getContent () !== '' ) {
6664 $ data = $ request ->toArray ();
6765 if (isset ($ data [self ::IS_GAME_MASTERED_ROOM ]) && $ data [self ::IS_GAME_MASTERED_ROOM ]) {
68- $ isGameMastered = true ;
6966 $ room ->setIsGameMastered (true );
7067 $ player ->setStatus (PlayerStatus::SPECTATING );
71- // Grant ROLE_MASTER to the User, not the Player
72- $ user ->setRoles (['ROLE_USER ' , 'ROLE_MASTER ' ]);
7368 }
7469 }
7570
7671 $ room ->addPlayer ($ player );
72+ $ user ->addPlayer ($ player );
7773
7874 $ this ->roomRepository ->store ($ room );
7975 $ this ->playerRepository ->store ($ player );
Original file line number Diff line number Diff line change @@ -360,10 +360,6 @@ public function setMissionSwitchUsed(bool $missionSwitchUsed): self
360360
361361 public function isGameMaster (): bool
362362 {
363- if ($ this ->user === null ) {
364- return false ;
365- }
366-
367- return in_array ('ROLE_MASTER ' , $ this ->user ->getRoles (), true );
363+ return $ this ->status === PlayerStatus::SPECTATING ;
368364 }
369365}
You can’t perform that action at this time.
0 commit comments