cards_against_humanity
cards_against_humanity copied to clipboard
Be able to kick players
Someone who was disconnected was still in the game and there was no way to remove them.
https://github.com/haviduck/cards_against_humanity/commit/6c2db0c3d7fde1eb3d10a99ca77e0a4faf79b785
https://github.com/haviduck/cards_against_humanity/commit/6be5637c6cb225f02a9719ae28002a6cea74c8a0
try that
@haviduck @ecameracci Mind submitting a pull request based on @haviduck's commits above? I have some minor comments but the overall implementation holds up
Is it possible for you to host a version with those commits to test @haviduck ? I can get some friends to try at some point this weekend along with #49 .
Yeah its not finished tho, but u can check out an early, non credited version here: cardsagainst.carlmartin.no. If it breaks, u can kick and generate New roomowner and czar by refreshing.
Alright, the kicking works, but not in the way I expected. I created a new game and sent the link, then the people I sent the link to became the roomowner with kicking privileges.
Should be fixed now
That's working better now. It kicks the player, but on my end (room owner), the player still remains on the list of users and if 'Kick' is clicked again, I get a ActiveRecord::RecordNotFound in PlayersController#destroy
error.
Yeah i gotta understand the event classes etc a bit better first, but ill let u know when it works as intended :)
im not able to reproduce it, the roomowner is redirected to game round when he kicks someone and the list is updated. can you see if it still happens for you @ecameracci ?
Still seems to be happening to me. I went to cardsagainst.carlmartin.no and continued a game that I already started, there was still one other person in the Users tab so I tried kicking them and they still stayed in the room until I manually refreshed the page. I'm using Firefox, but I'll try with Chrome once I can get someone to help me test this again.
Alright, I tried again on Chrome and it works as intended on Chrome, so it seems like the issue is with Firefox.
can this have anything to do with that cache line, @KevinBongart ?
The application uses cache in several places, in particular the player list, but the cache is on the server side and is invalidated when the game model is updated or when the list of players has changed. If you refresh the page and the player list changes, it's not a cache issue.
On some events, the app pushes updates to the clients (currently the updates are just orders to refresh the page, I'm working on smarter updates). For the page to automatically refresh when a player is kicked out, you can trigger Game#broadcast_refresh
.
FYI, it's a bit difficult for me to provide guidance when we're not using a pull request with code I can look at and comment directly, so I encourage you two to open a PR with the specific feature you want to add, whether it's in this repo or your own, and I'll do my best to help you ship it.
@KevinBongart hopefully my pr is right.
@ecameracci fixed for ff now
Was going to check this, but the test site @haviduck linked is down.
Sorry booted today. Up again now.
Ok, kicking players works now 👍
@haviduck @ecameracci FYI, the game is deployable to Heroku fairly easily and for free, in case you want to test out some features. I originally had it running there until the load went beyond what I was prepared to pay for Heroku, so I moved it to Dokku on a big Linode instance. But if you keep the domain private to a few players, Heroku works quite well.
In terms of kicking players, I'll let you open a PR to discuss implementations but the general philosophy I'd like to keep for this application is: no admin, no owner, no creator. Everybody in a game can do everything.
Kicking players, for instance, should be available to everybody who's in the game, especially if the person who started the game disconnects.