Skip to content

Commit

Permalink
fixup! fix(federation): Sync room properties on join
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu committed Aug 22, 2024
1 parent 5ec1d08 commit 16711be
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lib/Service/RoomService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1074,17 +1074,13 @@ public function syncPropertiesFromHostRoom(Room $local, array $host): void {
$this->setLastActivity($local, $lastActivity);
$changed[] = ARoomSyncedEvent::PROPERTY_LAST_ACTIVITY;
}
if (isset($host['lobbyState'], $host['lobbyTimer']) && $host['lobbyState'] !== $local->getLobbyState(false)) {
if (isset($host['lobbyState'], $host['lobbyTimer']) && ($host['lobbyState'] !== $local->getLobbyState(false) || $host['lobbyTimer'] !== ((int) $local->getLobbyTimer(false)?->getTimestamp()))) {
$hostTimer = $host['lobbyTimer'] === 0 ? null : $this->timeFactory->getDateTime('@' . $host['lobbyTimer']);
$localTimer = $local->getLobbyTimer(false);
if ($host['lobbyState'] !== $local->getLobbyState(false)
|| $hostTimer?->getTimestamp() !== $localTimer?->getTimestamp()) {
$success = $this->setLobby($local, $host['lobbyState'], $hostTimer);
if (!$success) {
$this->logger->error('An error occurred while trying to sync lobby of ' . $local->getId() . ' to ' . $host['lobbyState'] . ' with timer to ' . $host['lobbyTimer']);
} else {
$changed[] = ARoomModifiedEvent::PROPERTY_LOBBY;
}
$success = $this->setLobby($local, $host['lobbyState'], $hostTimer);
if (!$success) {
$this->logger->error('An error occurred while trying to sync lobby of ' . $local->getId() . ' to ' . $host['lobbyState'] . ' with timer to ' . $host['lobbyTimer']);
} else {
$changed[] = ARoomModifiedEvent::PROPERTY_LOBBY;
}
}
if (isset($host['callStartTime'], $host['callFlag'])) {
Expand Down

0 comments on commit 16711be

Please sign in to comment.