refactor(room): Move validateTimer() out of getLobbyState()/getLobbyTimer() getters#17810
Open
miaulalala wants to merge 1 commit intomainfrom
Open
refactor(room): Move validateTimer() out of getLobbyState()/getLobbyTimer() getters#17810miaulalala wants to merge 1 commit intomainfrom
validateTimer() out of getLobbyState()/getLobbyTimer() getters#17810miaulalala wants to merge 1 commit intomainfrom
Conversation
cbdac8f to
d094467
Compare
β¦tLobbyTimer() Part of the incremental migration of `Room` to extend `OCP\AppFramework\Db\Entity` (Phase 1b). `getLobbyState()` and `getLobbyTimer()` previously triggered a database write as a side effect when called β if the lobby timer had expired, they would silently reset the lobby state in the DB and fire events. This is incompatible with Entity's assumption that getters are pure. - Make `getLobbyState()` and `getLobbyTimer()` pure getters (remove `bool $validateTime` parameter) - Extract the timer check into `RoomService::validateLobbyTimer(Room $room)` using proper constructor DI - Call it explicitly at the relevant entry points: `RoomFormatter::formatRoomV4()`, `InjectionMiddleware::checkLobbyState()`, and `RoomPropertiesHelper::getPropertiesForSignaling()` - As a bonus, `ITimeFactory` is no longer needed in `Room`'s constructor The two callers that previously passed `getLobbyState(false)` to suppress the side effect (`RoomService::setLobby()` and `updateLocalRoomInfo()`) simply use the pure getter now. AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Anna Larch <anna@nextcloud.com>
d094467 to
20e762a
Compare
Member
There was a problem hiding this comment.
We don't need this file π
Contributor
Author
There was a problem hiding this comment.
I wanted it to verify behaviour during the refactor. It will be removed at the end.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
getLobbyState()andgetLobbyTimer()previously triggered a database write as a side effectwhen called β if the lobby timer had expired, they would silently reset the lobby state in the
DB and fire events. This is incompatible with Entity's assumption that getters are pure.
getLobbyState()andgetLobbyTimer()pure getters (removebool $validateTimeparameter)
RoomService::validateLobbyTimer(Room $room)using properconstructor DI
RoomFormatter::formatRoomV4(),InjectionMiddleware::checkLobbyState(), andRoomPropertiesHelper::getPropertiesForSignaling()ITimeFactoryis no longer needed inRoom's constructorThe two callers that previously passed
getLobbyState(false)to suppress the side effect(
RoomService::setLobby()andupdateLocalRoomInfo()) simply use the pure getter now.AI-Assisted-By: Claude Sonnet 4.6 noreply@anthropic.com
AI (if applicable)
π οΈ API Checklist
π Checklist
docs/has been updated or is not required