diff options
author | Thibaut Girka <thib@sitedethib.com> | 2018-05-21 16:40:02 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2018-05-21 16:40:02 +0200 |
commit | a4c9bda771c04526005f708dfb9ca2ccced60d52 (patch) | |
tree | 9ed60f78e2e8acc823bccb7c75ecaa3fdb1b7ab6 /app/controllers/api/v1 | |
parent | 98ecadbf99aa823164608f796a40ab1cd067bdc2 (diff) | |
parent | 46061dc041b0a2a4a3907976cc3432abdb1d67ec (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: app/javascript/styles/mastodon-light.scss config/locales/en.yml config/locales/fr.yml config/locales/simple_form.pl.yml config/themes.yml Conflicts resolved by deleting config/themes.yml, marking app/javascript/styles/mastodon-light.scss as added, and taking all new translation strings, not removing anything from them.
Diffstat (limited to 'app/controllers/api/v1')
-rw-r--r-- | app/controllers/api/v1/statuses_controller.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index 01880565c..289d91045 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -10,6 +10,12 @@ class Api::V1::StatusesController < Api::BaseController respond_to :json + # This API was originally unlimited, pagination cannot be introduced without + # breaking backwards-compatibility. Arbitrarily high number to cover most + # conversations as quasi-unlimited, it would be too much work to render more + # than this anyway + CONTEXT_LIMIT = 4_096 + def show cached = Rails.cache.read(@status.cache_key) @status = cached unless cached.nil? @@ -17,8 +23,8 @@ class Api::V1::StatusesController < Api::BaseController end def context - ancestors_results = @status.in_reply_to_id.nil? ? [] : @status.ancestors(DEFAULT_STATUSES_LIMIT, current_account) - descendants_results = @status.descendants(DEFAULT_STATUSES_LIMIT, current_account) + ancestors_results = @status.in_reply_to_id.nil? ? [] : @status.ancestors(CONTEXT_LIMIT, current_account) + descendants_results = @status.descendants(CONTEXT_LIMIT, current_account) loaded_ancestors = cache_collection(ancestors_results, Status) loaded_descendants = cache_collection(descendants_results, Status) |