mastodon/app/controllers/api/v1
Akihiko Odaki 64ef37b89d
Introduce ApplicationController#cache_collection_paginated_by_id (#14677)
* Replace incorrect use of distinct with group

Some uses of ActiveRecord::QueryMethods#distinct pass field names but they
are incorrect for the current version of Rails.

ActiveRecord::QueryMethods#group provides the expected behavior and
benefits performance. See commit 6da24aad4cafdef8d8a2c92bac2002a5fc2fe9c8.

* Introduce ApplicationController#cache_collection_paginated_by_id

ApplicationController#cache_collection_paginated_by_id fuses
ApplicationController#cache_collection and Paginable.paginate_by_id.

An advantage of this method is that it prevents from modifying scope which
Paginable.paginate_by_id may provide.
ApplicationController#cache_collection always return an array and there
is no possibility of the scope modification. It is also clear for a
programmer, considering the implication of "cache".

This method can also emit more efficient queries by using
Cacheable.cache_ids before calling Paginable.paginate_by_id.
2020-08-28 12:31:56 +02:00
..
accounts Introduce ApplicationController#cache_collection_paginated_by_id (#14677) 2020-08-28 12:31:56 +02:00
admin
announcements
apps
crypto Fix wrong route helper in encrypted messages controller (#13952) 2020-06-03 20:32:15 +02:00
featured_tags
instances
lists Extract counters from accounts table to account_stats table (#9295) 2018-11-19 00:43:52 +01:00
polls Add more tests for ActivityPub controllers (#13585) 2020-05-03 16:30:36 +02:00
push Add more tests for ActivityPub controllers (#13585) 2020-05-03 16:30:36 +02:00
statuses Fix not being able to unbookmark toots when blocked by their author (#14604) 2020-08-19 19:02:06 +02:00
timelines Introduce ApplicationController#cache_collection_paginated_by_id (#14677) 2020-08-28 12:31:56 +02:00
accounts_controller.rb
announcements_controller.rb
apps_controller.rb
blocks_controller.rb
bookmarks_controller.rb Eagerly load statuses with the main query in Api::V1::BookmarksController (#14674) 2020-08-28 12:30:23 +02:00
conversations_controller.rb
custom_emojis_controller.rb
directories_controller.rb
domain_blocks_controller.rb
endorsements_controller.rb
favourites_controller.rb Eagerly load statuses with the main query in Api::V1::FavouritesController (#14673) 2020-08-28 09:27:33 +02:00
featured_tags_controller.rb
filters_controller.rb
follow_requests_controller.rb
instances_controller.rb
lists_controller.rb
markers_controller.rb
media_controller.rb Add customizable thumbnails for audio and video attachments (#14145) 2020-06-29 13:56:55 +02:00
mutes_controller.rb
notifications_controller.rb Introduce ApplicationController#cache_collection_paginated_by_id (#14677) 2020-08-28 12:31:56 +02:00
polls_controller.rb Add more tests for ActivityPub controllers (#13585) 2020-05-03 16:30:36 +02:00
preferences_controller.rb
reports_controller.rb
scheduled_statuses_controller.rb
statuses_controller.rb Fix/14021 behaviour on add or remove toots (#14212) 2020-07-19 17:04:02 +02:00
streaming_controller.rb
suggestions_controller.rb
trends_controller.rb