SQL Queries for admins in Discourse
Go to file
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
.github/workflows DEV: Update CI workflows (#180) 2022-06-17 21:34:29 +02:00
app FIX: Allow groups to access system queries (#185) 2022-08-19 00:14:07 +08:00
assets FIX: fixed the blueing of the bookmark icon (#186) 2022-08-19 00:07:35 +08:00
config Update translations (#181) 2022-06-21 15:27:08 +02:00
db/migrate FIX: Store query groups in a temp table when fixing ids. (#68) 2020-09-28 12:23:53 -03:00
lib DEV: Bookmarkable reminder refinement (#183) 2022-07-18 13:40:24 +10:00
spec FIX: Allow groups to access system queries (#185) 2022-08-19 00:14:07 +08:00
test/javascripts DEV: Update linting setup and fix issues (#179) 2022-06-17 15:01:34 +02:00
.discourse-compatibility DEV: Update last .discourse-compatibility entry's target to 2.9.0.beta6 2022-07-18 14:59:14 +03:00
.eslintrc DEV: apply coding standards (#66) 2020-09-04 13:23:11 +02:00
.gitignore DEV: Update linting setup and fix issues (#179) 2022-06-17 15:01:34 +02:00
.prettierrc DEV: Minor clean-up (#119) 2021-07-02 10:31:16 +02:00
.rubocop.yml DEV: Move to rubocop-discourse. 2020-05-06 18:11:07 +02:00
.template-lintrc.js DEV: apply coding standards (#66) 2020-09-04 13:23:11 +02:00
Gemfile DEV: Add RubyGems as source 2020-09-25 11:46:42 -05:00
Gemfile.lock DEV: Update linting setup and fix issues (#179) 2022-06-17 15:01:34 +02:00
LICENSE Initial commit as a clone of discourse-tagging 2015-06-25 09:25:15 -07:00
README.md DEV: Update README.md (#164) 2022-02-21 20:59:32 +01:00
package.json DEV: Update linting setup and fix issues (#179) 2022-06-17 15:01:34 +02:00
plugin.rb FEATURE: Bookmarkable QueryGroups. (#177) 2022-06-14 23:07:02 +08:00
translator.yml DEV: Switch from Transifex to Crowdin 2020-07-16 14:00:47 +02:00
yarn.lock DEV: Update linting setup and fix issues (#179) 2022-06-17 15:01:34 +02:00

README.md

Data Explorer Plugin

This plugin allows admins to run SQL queries against the live Discourse database, including parameterized queries and formatting for several common column types.

For more information, please see: https://meta.discourse.org/t/data-explorer-plugin/32566