Return populated room object when joined #11675
Open
+22
−30
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.
While in the lounge, the client polls using
index()
which returns a compact model that in particular excludes the playlist. After the room is joined the playlist becomes important for the obvious reason that the user should be able to start playing, but also for the less-obvious reason that the client expects the playlist to be populated in order to preselect the first available item.Rather than adding a special condition for the client, it seems to make more sense to return the complete model here and potentially remove the
show()
API request. As far as I can tell the only remaining use (as far as the client's concerned) is to update the recent participants list, but it's otherwise quite wasteful and polls every 5 seconds.Beyond that, I believe playlists would be better served by the multiplayer server like daily challenge where statistics are pushed to the client in real time.
I noticed that the response was already mostly duplicated between
store()
andshow()
, so I took the liberty of splitting it out. Let me know if this is the correct way of doing things :)Sample returned model: