This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse
riking 1833b43ae2 FEATURE: Badge query validation, preview results, and EXPLAIN
Upon saving a badge or requesting a badge result preview,
BadgeGranter.contract_checks! will examine the provided badge SQL for
some contractual obligations - namely, the returned columns and use of
trigger parameters.

Saving the badge is wrapped in a transaction to make this easier, by
raising ActiveRecord::Rollback on a detected violation.

On the client, a modal view is added for the badge query sample run
results, named admin-badge-preview.
The preview action is moved up to the route.
The save action, on failure, triggers a 'saveError' action (also in the
route).

The preview action gains a new parameter, 'explain', which will give the
output of an EXPLAIN query for the badge sql, which can be used by forum
admins to estimate the cost of their badge queries.
The preview link is replaced by two links, one which omits (false) and
includes (true) the EXPLAIN query.

The Badge.save() method is amended to propogate errors.

Badge::Trigger gets some utility methods for use in the
BadgeGranter.contract_checks! method.

Additionally, extra checks outside of BadgeGranter.contract_checks! are
added in the preview() method, to cover cases of null granted_at
columns.

An uninitialized variable path is removed in the backfill() method.

TODO - it would be nice to be able to get the actual names of all
columns the provided query returns, so we could give more errors
2014-08-31 11:25:44 -07:00
..
components mods can use shield glyph as well, don't need two 2014-08-25 23:49:39 -07:00
controllers TRIVIAL: add line break before time for post navigator 2014-08-30 16:14:00 +05:30
dialects Fix: dialect block parser should not eat next block's whitespace 2014-08-26 14:11:23 +02:00
ember ES6: grouped-each helper and moved event dispatcher to an initializer 2014-08-13 16:46:59 -04:00
helpers FIX: use short date format for timestamp 2014-08-27 12:56:52 +05:30
initializers FIX: Centralize Top rendering, remove old code paths. Fix some bugs. 2014-08-28 14:34:31 -04:00
lib FIX: autocomplete username failing to pop up 2014-09-01 01:48:17 +10:00
mixins PERF: Do far fewer checks and use a lot less memory when loading more 2014-08-27 15:31:06 -04:00
models FEATURE: Badge query validation, preview results, and EXPLAIN 2014-08-31 11:25:44 -07:00
routes FIX: dual modal when deleting spammer in the flag modal 2014-08-29 13:05:51 +02:00
templates TRIVIAL: add line break before time for post navigator 2014-08-30 16:14:00 +05:30
views Merge pull request #2715 from cpradio/master 2014-08-29 17:04:52 -04:00