Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to kick players #48

Open
ecameracci opened this issue Apr 23, 2020 · 18 comments
Open

Be able to kick players #48

ecameracci opened this issue Apr 23, 2020 · 18 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ecameracci
Copy link

Someone who was disconnected was still in the game and there was no way to remove them.

@haviduck
Copy link

haviduck@6c2db0c

haviduck@6be5637

try that

@KevinBongart
Copy link
Owner

@haviduck @ecameracci Mind submitting a pull request based on @haviduck's commits above? I have some minor comments but the overall implementation holds up

@KevinBongart KevinBongart added enhancement New feature or request good first issue Good for newcomers labels Apr 24, 2020
@ecameracci
Copy link
Author

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 .

@haviduck
Copy link

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.

@ecameracci
Copy link
Author

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.

@haviduck
Copy link

Should be fixed now

@ecameracci
Copy link
Author

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.

@haviduck
Copy link

Yeah i gotta understand the event classes etc a bit better first, but ill let u know when it works as intended :)

@haviduck
Copy link

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 ?

@ecameracci
Copy link
Author

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.

@ecameracci
Copy link
Author

Alright, I tried again on Chrome and it works as intended on Chrome, so it seems like the issue is with Firefox.

@haviduck
Copy link

can this have anything to do with that cache line, @KevinBongart ?

@KevinBongart
Copy link
Owner

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.

@haviduck
Copy link

@KevinBongart hopefully my pr is right.

@ecameracci fixed for ff now

@ecameracci
Copy link
Author

ecameracci commented May 2, 2020

Was going to check this, but the test site @haviduck linked is down.

@haviduck
Copy link

haviduck commented May 3, 2020

Sorry booted today. Up again now.

@ecameracci
Copy link
Author

Ok, kicking players works now 👍

@KevinBongart
Copy link
Owner

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants