Fixes 500 error when viewing the "Tag Mods" page without having the role on the database #10515
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.
What type of PR is this? (check all applicable)
Description
I think that the issue (#10060) is self-explanatory. What was happening with @msarit was that she was visiting the
/admin/mods?state=tag_moderatorwithout having a role namedtag_moderatoron the database.The query class explicitly "blew up" in this condition. I tried to follow the approach proposed by @Zhao-Andy:
The query class now doesn't raise an exception in the scenario above. Instead returns an empty result set
The mods page now returns a generic "there are mods matching your search" warning if there are no mods matching the query
Related Tickets & Documents
#10060
QA Instructions, Screenshots, Recordings
Go to the
/admin/modspageSearch by a random text string which yields no results and see that a "no results" message is rendered
Delete the
tag_moderatorrole from your database (Role.find_by(name: "tag_moderator").delete)Go to
/admin/mods?state=tag_moderatorSee that a "no results" message is rendered
Added tests?
Added to documentation?