-
Notifications
You must be signed in to change notification settings - Fork 32
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
Support role for puzzles #1134
base: main
Are you sure you want to change the base?
Support role for puzzles #1134
Conversation
Allows the designation of individual users in a support role for a puzzle. A puzzle supporter would function basically as an author who does not appear in the credits, so the safest course is to choose that path of least resistance and implement it that way. This minimizes the possibility for bugs. Also taking this opportunity to broaden the animal representation of the demo project.
Fixes #1096 |
|
||
if (!(await _context.PuzzleAuthors.Where(m => m.PuzzleID == puzzleId && m.AuthorID == NewSupportID).AnyAsync())) | ||
{ | ||
_context.PuzzleAuthors.Add(new PuzzleAuthors() { PuzzleID = puzzleId, AuthorID = NewSupportID, SupportOnly = true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this will throw because of a duplicate key if the user is already an author on the puzzle (or vice versa if you're trying to promote support to author).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't throw because there's only one table for both - PuzzleAuthors. Since the query doesn't check the value of the SupportOnly field, the query covers both cases simultaneously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the only users who appear in the list are users in PotentialAuthorOrSupport, so casual use won't run into any weird scenarios unless you click twice or race another user.
@@ -55,7 +55,7 @@ public IActionResult OnGet() | |||
|
|||
for (int i = 1; ; i++) | |||
{ | |||
string name = $"Watership Demo {i}"; | |||
string name = $"Animal Farm {i}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocking comment, but Animal Farm is a bit depressing.... any chance you can come up with something more fun if you want to change these?
Allows the designation of individual users in a support role for a puzzle.
A puzzle supporter would function basically as an author who does not appear in the credits, so the safest course is to choose that path of least resistance and implement it that way. This minimizes the possibility for bugs.
Also taking this opportunity to broaden the animal representation of the demo project.