mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 15:32:09 +00:00
kick forever
This commit is contained in:
@@ -80,7 +80,6 @@ class RoomParticipationService
|
||||
} else {
|
||||
$player->update([
|
||||
'last_seen_at' => now(),
|
||||
'inactive_at' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -150,16 +149,13 @@ class RoomParticipationService
|
||||
]);
|
||||
$change = RoomStateChange::PlayerJoined;
|
||||
} else {
|
||||
if ($player->inactive_at !== null) {
|
||||
$change = RoomStateChange::PlayerJoined;
|
||||
} elseif ($player->name !== $playerName) {
|
||||
if ($player->name !== $playerName) {
|
||||
$change = RoomStateChange::PlayerUpdated;
|
||||
}
|
||||
|
||||
$updates = [
|
||||
'name' => $playerName,
|
||||
'last_seen_at' => now(),
|
||||
'inactive_at' => null,
|
||||
];
|
||||
|
||||
if (
|
||||
@@ -282,14 +278,14 @@ class RoomParticipationService
|
||||
?User $user,
|
||||
?Player $currentPlayer,
|
||||
): void {
|
||||
$stateVersion = DB::transaction(function () use ($room, $player, $user, $currentPlayer): ?int {
|
||||
$stateVersion = DB::transaction(function () use ($room, $player, $user, $currentPlayer): int {
|
||||
$lockedRoom = Room::query()
|
||||
->lockForUpdate()
|
||||
->findOrFail($room->id);
|
||||
|
||||
$lockedCurrentPlayer = $currentPlayer === null
|
||||
? null
|
||||
: $lockedRoom->activePlayers()
|
||||
: $lockedRoom->players()
|
||||
->lockForUpdate()
|
||||
->find($currentPlayer->id);
|
||||
$isOwner = $user !== null && $lockedRoom->owner_id === $user->id;
|
||||
@@ -312,13 +308,7 @@ class RoomParticipationService
|
||||
403,
|
||||
);
|
||||
|
||||
if ($lockedPlayer->inactive_at !== null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$lockedPlayer->update([
|
||||
'inactive_at' => now(),
|
||||
]);
|
||||
$lockedPlayer->delete();
|
||||
$lockedRoom->update([
|
||||
'last_activity_at' => now(),
|
||||
'state_version' => $lockedRoom->state_version + 1,
|
||||
@@ -327,10 +317,6 @@ class RoomParticipationService
|
||||
return $lockedRoom->state_version;
|
||||
});
|
||||
|
||||
if ($stateVersion === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
RoomStateChanged::dispatch(
|
||||
$room->id,
|
||||
$stateVersion,
|
||||
|
||||
Reference in New Issue
Block a user