1
0
Fork 0
forked from fedi/mastodon
mastodon/app
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.
2020-08-31 12:47:09 +02:00
..
chewy Change tootctl search deploy algorithm (#14300) 2020-07-14 18:10:35 +02:00
controllers Make Array-creation behavior of Paginable more predictable (#14687) 2020-08-31 12:47:09 +02:00
helpers Add a visibility icon to status (#14123) 2020-06-25 22:43:59 +02:00
javascript Add WebAuthn as an alternative 2FA method (#14466) 2020-08-24 16:46:27 +02:00
lib Add support for dereferencing objects through bearcaps (#14683) 2020-08-30 12:34:20 +02:00
mailers Add WebAuthn as an alternative 2FA method (#14466) 2020-08-24 16:46:27 +02:00
models Make Array-creation behavior of Paginable more predictable (#14687) 2020-08-31 12:47:09 +02:00
policies Add ability to delete files uploaded for settings in admin UI (#13192) 2020-03-08 16:00:24 +01:00
presenters Add user notes on accounts (#14148) 2020-06-30 19:19:50 +02:00
serializers Add thumbnail_remote_url in MediaAttachment REST response (#14358) 2020-07-19 19:53:31 +02:00
services Fix inefficiencies in fan-out-on-write service (#14682) 2020-08-30 12:33:59 +02:00
validators Improve email address validation (#14565) 2020-08-12 12:40:25 +02:00
views Add WebAuthn as an alternative 2FA method (#14466) 2020-08-24 16:46:27 +02:00
workers Changed retries and rescued in ActivityPub::ProcessingWorker (#14355) 2020-07-20 11:26:12 +02:00