discourse/spec
Sam a7628c1d74 FIX: use ordered_posts for last post check, not the posts relation
The `posts` relation on `Topic` is not ordered. Using `Topic.posts.first`
is basically the same as asking for a random post, it will depend on DB
order. This breaks on Topic merge and split for example.

Additionally, a huge problem with that is that it forces active record down
a slow path. `Topic.posts.first` is extremely slow on giant topics, since
it has no default ordering it appears AR materializes the entire set prior
to doing `first`.

This commit also illustrates the importance of testing, initially I only
fixed the second instance of the problem in `post_validator.rb` but testing
revealed that the problem was repeated at the top of the file.

Longer term we should consider a larger change of default ordering the posts
relations so people do not fall down this trap anymore.
2019-01-18 13:18:40 +11:00
..
components FIX: use ordered_posts for last post check, not the posts relation 2019-01-18 13:18:40 +11:00
fabricators FEATURE: Consolidate likes notifications. (#6879) 2019-01-16 10:40:16 +08:00
fixtures FEATURE: allow extending CSP base-uri and object-src 2019-01-09 15:34:14 -05:00
helpers FEATURE: Allow the base font size to be changed on a per-user basis (#6859) 2019-01-14 13:21:46 +00:00
import_export FIX: topic and category exporters were only exporting users who created the first post 2018-01-16 12:51:53 -05:00
integration FEATURE: Automatically expire keys if not used for a configurable amount of time. (#6264) 2018-08-20 17:36:14 +02:00
integrity FIX: Relative links in translations should work with subfolder 2018-11-08 23:31:05 +00:00
jobs FEATURE: introduce ultra_low priority queue 2019-01-17 14:53:19 +11:00
lib FEATURE: Support for localized themes (#6848) 2019-01-17 11:46:11 +00:00
mailers FEATURE: Include "via <site_name>" in email From header 2019-01-04 17:06:19 +01:00
models FIX: Do not hide posts automatically when flagged by staff user 2019-01-18 01:33:55 +05:30
multisite FIX: Multisite DB was leaving old data in test mode 2019-01-09 15:20:37 -05:00
requests FEATURE: Support for localized themes (#6848) 2019-01-17 11:46:11 +00:00
serializers DEV: more accurate spec for UserSummarySerializer 2019-01-14 07:26:10 +05:30
services DEV: Consolidate and remove duplicated liked notifications tests. 2019-01-17 11:14:17 +08:00
support DEV: Stablize the multisite tests. 2019-01-16 10:29:36 +08:00
tasks suppress print output when running specs 2017-10-31 16:06:11 +05:30
views/omniauth_callbacks FEATURE: Use translated name for 'your email has been authenticated by' (#6649) 2018-11-22 19:12:04 +00:00
rails_helper.rb DEV: Stablize the multisite tests. 2019-01-16 10:29:36 +08:00