Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
05f8c375
Unverified
Commit
05f8c375
authored
6 years ago
by
Eugen Rochko
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove small pagination limit from context API (#7564)
Fix #7557
parent
9ada5328
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/controllers/api/v1/statuses_controller.rb
+8
-2
8 additions, 2 deletions
app/controllers/api/v1/statuses_controller.rb
with
8 additions
and
2 deletions
app/controllers/api/v1/statuses_controller.rb
+
8
−
2
View file @
05f8c375
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment