You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mastodon/app/controllers/api/v1
Akihiko Odaki ae871c4d46
Make Array-creation behavior of Paginable more predictable (#14687)
* Make Array-creation behavior of Paginable more predictable

Paginable.paginate_by_id usually returns ActiveRecord::Relation, but it
returns an Array if min_id option is present. The behavior caused problems
fixed with the following commits:
- 552e886b64
- b63ede5005
- 64ef37b89d

To prevent from recurring similar problems, this commit introduces two
changes:
- The scope now always returns an Array whether min_id option is present
  or not.
- The scope is renamed to to_a_paginated_by_id to clarify it returns an
  Array.

* Transform Paginable.to_a_paginated_by_id from a scope to a class method

https://api.rubyonrails.org/classes/ActiveRecord/Scoping/Named/ClassMethods.html#method-i-scope
> The method is intended to return an ActiveRecord::Relation object, which
> is composable with other scopes.

Paginable.to_a_paginated_by_id returns an Array and is not appropriate
as a scope.
5 years ago
..
accounts Introduce ApplicationController#cache_collection_paginated_by_id (#14677) 5 years ago
admin Make Array-creation behavior of Paginable more predictable (#14687) 5 years ago
announcements Add announcements (#12662) 5 years ago
apps Remove useless `respond_to` calls (#13208) 5 years ago
crypto Make Array-creation behavior of Paginable more predictable (#14687) 5 years ago
featured_tags Remove useless `respond_to` calls (#13208) 5 years ago
instances Remove useless `respond_to` calls (#13208) 5 years ago
lists Extract counters from accounts table to account_stats table (#9295) 6 years ago
polls Add more tests for ActivityPub controllers (#13585) 5 years ago
push Add more tests for ActivityPub controllers (#13585) 5 years ago
statuses Fix not being able to unbookmark toots when blocked by their author (#14604) 5 years ago
timelines Introduce ApplicationController#cache_collection_paginated_by_id (#14677) 5 years ago
accounts_controller.rb Add specific rate limits for posting and following (#13172) 5 years ago
announcements_controller.rb Fix dismissing an announcement twice raising an obscure error (#13124) 5 years ago
apps_controller.rb Add whitelist mode (#11291) 6 years ago
blocks_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
bookmarks_controller.rb Make Array-creation behavior of Paginable more predictable (#14687) 5 years ago
conversations_controller.rb Make Array-creation behavior of Paginable more predictable (#14687) 5 years ago
custom_emojis_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
directories_controller.rb Add profile directory to web UI (#11688) 6 years ago
domain_blocks_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
endorsements_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
favourites_controller.rb Make Array-creation behavior of Paginable more predictable (#14687) 5 years ago
featured_tags_controller.rb Add featured tags API (#11778) 6 years ago
filters_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
follow_requests_controller.rb Add updated relationship to follow request API responses (#11800) 6 years ago
instances_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
lists_controller.rb Fix low-hanging rubocop gripes (#8458) 7 years ago
markers_controller.rb Add timeline read markers API (#11762) 6 years ago
media_controller.rb Add customizable thumbnails for audio and video attachments (#14145) 5 years ago
mutes_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
notifications_controller.rb Introduce ApplicationController#cache_collection_paginated_by_id (#14677) 5 years ago
polls_controller.rb Add more tests for ActivityPub controllers (#13585) 5 years ago
preferences_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
reports_controller.rb Add rate limit for reporting (#13390) 5 years ago
scheduled_statuses_controller.rb Make Array-creation behavior of Paginable more predictable (#14687) 5 years ago
statuses_controller.rb Fix/14021 behaviour on add or remove toots (#14212) 5 years ago
streaming_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
suggestions_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago
trends_controller.rb Remove useless `respond_to` calls (#13208) 5 years ago