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

Don't allow user to join league twice #16

Open
JoeKennedy opened this issue Apr 28, 2016 · 0 comments
Open

Don't allow user to join league twice #16

JoeKennedy opened this issue Apr 28, 2016 · 0 comments

Comments

@JoeKennedy
Copy link
Owner

JoeKennedy commented Apr 28, 2016

This came up when one user somehow became the owner of two teams. I'm guessing what happened was that he made the league and made his team the last team. So he was made the owner of the first team (because the system automatically does that at the moment) and then he joined with his team, so he was made the owner of that one as well.

Fixing issue #3 should alleviate that specific case, but it doesn't prevent a user from accidentally joining the league using the link .

I can't use a unique constraint for this at the moment, because teamOwnerId is currently a Maybe UserId and Yesod doesn't allow unique constraints for nullable fields. This would probably come for free with implementing issue #15, since team owner would likely be a separate table, a constraint like UniqueTeamOwnerLeagueIdUserId would suffice.

However, a request should probably check if there's an entry for the leagueId userId pair and render an alert that says something like "this person already owns a team in the league", rather than just spitting out a unique constraint error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant