Merged
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
709b2fd to
61b8521
Compare
This was referenced May 9, 2025
Merged
1875470 to
b7ca8de
Compare
61b8521 to
76519ae
Compare
76519ae to
ea518a6
Compare
ea518a6 to
2a598e6
Compare
Holmes98
reviewed
May 9, 2025
Comment on lines
+31
to
+34
| if params.key?(:debug) && current_user.is_admin? | ||
| render xml: @submission | ||
| else | ||
| render :show |
Member
There was a problem hiding this comment.
If we're keeping this, I'd prefer keeping the .xml syntax if possible rather than changing to ?debug, since it's clearer about the response format and makes it easier for other formats to be added in the future (e.g. JSON). Potentially either of these?
Suggested change
| if params.key?(:debug) && current_user.is_admin? | |
| render xml: @submission | |
| else | |
| render :show | |
| respond_to do |format| | |
| format.html # show.html.erb | |
| format.xml { render xml: @submission } if current_user.is_admin? | |
| end |
Suggested change
| if params.key?(:debug) && current_user.is_admin? | |
| render xml: @submission | |
| else | |
| render :show | |
| if request.format.xml? && current_user.is_admin? | |
| render xml: @submission | |
| else | |
| render :show |
Otherwise I don't mind if we just remove the XML response from here as well for now (I think the cases you found in the logs were probably just me testing that from when you originally asked about this).
Almost none of these were being used usefully (as checked by a quick grep of the logs on the server) except for SubmissionController#show, which I have left in place for now. I also removed all comments refering to routes, as a great number of them are incorrect and we discussed briefly on discord and decided to remove. (use `bundle exec rake routes` instead. Additionally, a fixed a couple of cases of record#destory being called instead of record#destroy!. You pretty much always want to use destroy! - the former version has no errors or warnings if the delete fails for any reason, which is rarely what you want.
Admin users can add `?debug` to the URL to get the XML dump of the specific submission, which can be useful for debugging certain issues with judging etc. This replaces using `.xml` to request a different format, and means we don't need to be careful about restricting formats based on the logged in user - instead, we can decide what we want to expose irrespective of format, and rely on the permission model instead. Longer term - it might be a better idea to add a "debug" tab to the submission view for admin users, but this will do for now.
We no longer need these as we're no longer varying any content by format.
Per a discussion in github [1] and a follow up in Discord [2] no-one seems to need this, and it's trivial to restore later if we do. [1] #292 (comment) [2] https://discord.com/channels/670126531489824788/678154623571329025/1371774374872354898
2a598e6 to
8a3e0ff
Compare
Holmes98
approved these changes
May 18, 2025
Contributor
Author
Merge activity
|
This was referenced Jul 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Almost none of these were being used usefully (as checked by a quick
grep of the logs on the server) except for SubmissionController#show,
which I have left in place for now. I also removed all comments refering
to routes, as a great number of them are incorrect and we discussed
briefly on discord and decided to remove. (use
bundle exec rake routesinstead. Additionally, a fixed a couple of cases of record#destory being
called instead of record#destroy!. You pretty much always want to use
destroy! - the former version has no errors or warnings if the delete
fails for any reason, which is rarely what you want.