-
Notifications
You must be signed in to change notification settings - Fork 156
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
Preventing self-validation #602
Conversation
@ethan-nelson This is great! Thank you so much for contributing to the code. That's something we can tick off the list of TM enhancements once successfully pulled. |
validation_message = _("You cannot validate a task that you have marked done.") | ||
%> | ||
<button type="submit" rel="tooltip" | ||
name="validate" |
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 guess some of these tags aren't absolutely necessary on the button, but I kept them in to be consistent with the enabled one (sans the tooltip, which will not show up if you hover over a disabled button).
And, glad to help 🎊 |
Hi @ethan-nelson. By the way, there seem to be problems with the build which are not due to your pull request. |
@pgiraud sounds like a plan. I'll revise and resubmit. |
While you're at it, you can rebase onto master to get travis happy. |
A single button is employed. Now, we apply attributes as to whether the user is allowed to validate or not. If they can, we add `type="submit"`. Otherwise, we add `type="button" disabled` and also include a div explaining that the user cannot self-validate.
Rearranged the code a bit and tested it. Let me know if I should make any further modifications. |
From #589 and multiple mailing list posts, a pull request to prevent self-validation (save project managers or admins).
From the tasks view, the object task is already populated from a database query and sorted by date. Thus, we take the most recent state log and compare it against the current user. If they match, and the user is not an admin or project manager, we disable the submission button and include a friendly message (see picture below). Else, we let them--namely other people or by self if project manager/admin--have the option to validate the tile.
This ensures that everyone is still able to self-invalidate a tile.