discourse/app/models
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
..
concerns FEATURE: vBulletin importer 2014-08-18 13:04:08 +02:00
about.rb TWEAK: Don't include moderators on "About" if they are admins. 2014-08-20 12:43:02 -04:00
admin_dashboard_data.rb removed usless access modifiers specified in models 2014-08-19 07:28:21 +05:30
api_key.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
backup.rb TRIVIAL: do not remove backups in development 2014-08-20 18:58:58 +02:00
badge_grouping.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
badge_type.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
badge.rb FEATURE: Badge query validation, preview results, and EXPLAIN 2014-08-31 11:25:44 -07:00
category_custom_field.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
category_featured_topic.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
category_featured_user.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
category_group.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
category_list.rb FEATURE: Subcategory list on parent subcategory page. 2014-07-02 16:47:43 -04:00
category_search_data.rb FEATURE: Badge progress 2014-07-03 17:29:44 +10:00
category_user.rb removed usless access modifiers specified in models 2014-08-19 07:28:21 +05:30
category.rb FIX: uncategorized counts were always 0. topics_year, topics_month, topics_week, topics_day 2014-08-27 15:58:32 -04:00
color_scheme_color.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
color_scheme.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
digest_email_site_setting.rb Enum site settings can have translatable names in dropdown. Add setting for how often users get digest emails by default: default_digest_email_frequency. 2013-08-23 17:36:25 -04:00
discourse_single_sign_on.rb Fix SSO avatar downloading issues. 2014-08-27 21:35:54 +08:00
discourse_version_check.rb Drop Rails3 support 2014-02-17 19:42:08 +01:00
draft_sequence.rb BUGFIX: eliminate drafts for system user 2014-06-25 10:55:35 +10:00
draft.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
email_log.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
email_token.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
error_log.rb removed usless access modifiers specified in models 2014-08-19 07:28:21 +05:30
export_csv.rb FIX: crashing job 2014-08-26 16:22:13 +10:00
facebook_user_info.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
github_user_info.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
global_setting.rb removed usless access modifiers specified in models 2014-08-19 07:28:21 +05:30
google_user_info.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
group_custom_field.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
group_user.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
group.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
incoming_domain.rb FIX: catch specific exception 2014-08-06 10:00:55 +10:00
incoming_link.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
incoming_links_report.rb PERF: finalize porting to new incoming links structure 2014-08-04 16:43:57 +10:00
incoming_referer.rb FIX: catch specific exception 2014-08-06 10:00:55 +10:00
invite_redeemer.rb removed useless assignments at some places 2014-08-19 18:10:23 +05:30
invite.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
invited_group.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
leader_requirements.rb FIX: suspended users cannot be trust level 3 2014-08-29 12:33:34 -04:00
locale_site_setting.rb removed usless access modifiers specified in models 2014-08-19 07:28:21 +05:30
notification.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
oauth2_user_info.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
optimized_image.rb BUGFIX: explicit code is often better... 2014-07-04 16:05:50 +02:00
permalink.rb FEATURE: add a way to map arbitrary urls to a topic, post, or category. Useful for sites that have migrated to Discourse and want to redirect from their old site to Discourse with 301 redirects. 2014-08-28 15:58:24 -04:00
plugin_store_row.rb update annotations 2014-04-08 17:35:44 +02:00
plugin_store.rb removed useless assignments at some places 2014-08-19 18:10:23 +05:30
post_action_type.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
post_action.rb Centralize MessageBus post updates 2014-08-28 20:40:36 -07:00
post_alert_observer.rb FEATURE: new "disable_edit_notifications" site setting 2014-06-11 17:14:00 +02:00
post_analyzer.rb Not initializing variable for looping if unused in loop 2014-08-15 03:24:55 +05:30
post_custom_field.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
post_detail.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
post_mover.rb FIX: Moving posts was not updating reply_count and 2014-08-20 14:15:23 -04:00
post_reply.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
post_revision.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
post_search_data.rb FEATURE: Badge progress 2014-07-03 17:29:44 +10:00
post_timing.rb PERF: stop mucking with user stats every 15 minutes 2014-08-07 14:20:42 +10:00
post_upload.rb update annotations 2014-04-08 17:35:44 +02:00
post.rb Centralize MessageBus post updates 2014-08-28 20:40:36 -07:00
quoted_post.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
report.rb FEATURE: flag dispositions normalization 2014-07-28 19:28:07 +02:00
rtl.rb Enable RTL direction in emails. 2014-08-27 14:38:03 +03:00
s3_region_site_setting.rb removed usless access modifiers specified in models 2014-08-19 07:28:21 +05:30
screened_email.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
screened_ip_address.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
screened_url.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
search_observer.rb PERF: new table used for title similarity search 2014-08-08 15:50:26 +10:00
single_sign_on_record.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
site_content_type.rb FEATURE: allow for custom HTML inside the <head> tags 2014-01-02 16:22:04 +01:00
site_content.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
site_customization.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
site_setting.rb correct annotations 2014-08-27 15:30:17 +10:00
site.rb FIX: Don't show the category edit button unless the user can edit the 2014-08-12 13:31:05 -04:00
top_lists.rb BUGFIX: show the draft on top page 2014-02-06 11:39:43 +01:00
top_menu_item.rb BUGFIX: proper handling of top_menu_items 2014-02-03 16:08:00 +01:00
top_topic.rb removed usless access modifiers specified in models 2014-08-19 07:28:21 +05:30
topic_allowed_group.rb update annotations 2014-04-08 17:35:44 +02:00
topic_allowed_user.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
topic_custom_field.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
topic_embed.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
topic_featured_users.rb FIX: ensure consistency on topic featured users 2014-08-18 17:13:32 +10:00
topic_invite.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
topic_link_click.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
topic_link.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
topic_list.rb FIX: Centralize Top rendering, remove old code paths. Fix some bugs. 2014-08-28 14:34:31 -04:00
topic_notifier.rb Perform the where(...).first to find_by(...) refactoring. 2014-05-06 14:41:59 +01:00
topic_participants_summary.rb FEATURE: add the first 3 participants in a private message 2014-05-12 09:32:49 +02:00
topic_poster.rb topic_poster.rb: Fix formatting of the attributes return value 2013-03-23 19:09:01 +05:30
topic_posters_summary.rb UX: Don't highlight the latest poster in the topic list if there is only 2014-08-20 12:09:39 -04:00
topic_status_update.rb FEATURE: allow moderators to globally pin topics 2014-04-07 16:38:51 +10:00
topic_tracking_state.rb FIX: more reliable topic list counts 2014-08-05 13:27:34 +10:00
topic_user.rb PERF/FIX: Dismiss Post coming back 2014-08-11 10:26:46 +10:00
topic_view_item.rb Avoid using to_s when performing String Interpolation 2014-08-14 23:55:27 +05:30
topic.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
trust_level_setting.rb removed usless access modifiers specified in models 2014-08-19 07:28:21 +05:30
twitter_user_info.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
upload.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
user_action_observer.rb BUGFIXES: properly deal with bookmarks and deleted posts 2014-06-04 17:41:11 +02:00
user_action.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
user_avatar.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
user_badge.rb FIX: remove faulty "ensure consistency" badge job 2014-08-11 09:21:06 +10:00
user_custom_field.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
user_email_observer.rb Drop Rails3 support 2014-02-17 19:42:08 +01:00
user_history.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
user_open_id.rb FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
user_profile.rb PERF: last seen index on users 2014-08-07 13:33:11 +10:00
user_search_data.rb FEATURE: Badge progress 2014-07-03 17:29:44 +10:00
user_search.rb FIX: Don't show profile pages for inactive users and don't show them in 2014-08-13 13:30:25 -04:00
user_stat.rb PERF: stop mucking with user stats every 15 minutes 2014-08-07 14:20:42 +10:00
user_visit.rb Update annotations 2014-02-07 11:07:52 +11:00
user.rb Add a message to the staff logs indicating why a user was purged 2014-08-27 16:05:07 -04:00
username_validator.rb [0] is shorter than [0,1] :) 2013-12-17 16:30:25 +01:00