discourse-data-explorer/spec
Frank 16bb6a946c
FIX: Allow groups to access system queries (#185)
* FIX: allow groups to access system queries (without having to run the query once first)

Bug is: Trying to allow a group to access a system query results in a Discourse::NotFound unless the query is run first.

Cause:

 - System queries don't exist in the database by default
 - update calls set_query before action
 - set_query searches the database for the system query with Query.find_by(:id), which will not exist by default.
 - running system queries first fixes this because Query.find is overridden to include system queries (Queries.default) in its results, avoiding the Discourse::NotFound.

Solution: use the overridden Query.find in set_query to include system queries in the search, instead of Query.find_by(:id)

* Added test for fixing allowing groups to access system query.

* Fixed test formatting.
2022-08-19 00:14:07 +08:00
..
fabricators FEATURE: Bookmarkable QueryGroups. (#177) 2022-06-14 23:07:02 +08:00
integration FEATURE: Add an API scope for running queries (#154) 2022-01-21 07:15:04 +03:00
jobs/scheduled FEATURE: destroy old hidden queries (#82) 2020-11-25 22:09:05 +05:30
lib DEV: Bookmarkable reminder refinement (#183) 2022-07-18 13:40:24 +10:00
requests FIX: Allow groups to access system queries (#185) 2022-08-19 00:14:07 +08:00
guardian_spec.rb DEV: Clean up some specs code (#161) 2022-02-01 21:38:24 +01:00