Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mastofe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Pleroma
mastofe
Commits
7e58303a
Commit
7e58303a
authored
9 years ago
by
Eugen Rochko
Browse files
Options
Downloads
Patches
Plain Diff
Limit Atom feeds to 20 items by default, add pagination by max_id
(But there are no Atom feed pagination elements yet)
parent
c8999a11
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/controllers/accounts_controller.rb
+1
-1
1 addition, 1 deletion
app/controllers/accounts_controller.rb
app/models/stream_entry.rb
+2
-1
2 additions, 1 deletion
app/models/stream_entry.rb
app/views/accounts/show.atom.ruby
+1
-1
1 addition, 1 deletion
app/views/accounts/show.atom.ruby
with
4 additions
and
3 deletions
app/controllers/accounts_controller.rb
+
1
−
1
View file @
7e58303a
...
...
@@ -7,7 +7,7 @@ class AccountsController < ApplicationController
def
show
respond_to
do
|
format
|
format
.
html
{
@statuses
=
@account
.
statuses
.
order
(
'id desc'
).
with_includes
.
with_counters
.
paginate
(
page:
params
[
:page
],
per_page:
10
)}
format
.
atom
{
@entries
=
@account
.
stream_entries
.
order
(
'id desc'
).
with_includes
}
format
.
atom
{
@entries
=
@account
.
stream_entries
.
order
(
'id desc'
).
with_includes
.
paginate_by_max_id
(
20
,
params
[
:max_id
]
||
nil
)
}
end
end
...
...
This diff is collapsed.
Click to expand it.
app/models/stream_entry.rb
+
2
−
1
View file @
7e58303a
...
...
@@ -4,7 +4,8 @@ class StreamEntry < ActiveRecord::Base
validates
:account
,
:activity
,
presence:
true
scope
:with_includes
,
->
{
includes
(
:activity
)
}
scope
:with_includes
,
->
{
includes
(
:activity
)
}
scope
:paginate_by_max_id
,
->
(
limit
,
max_id
)
{
order
(
'id desc'
).
limit
(
limit
).
where
(
max_id
.
nil?
?
'1=1'
:
[
'id < ?'
,
max_id
])
}
def
object_type
orphaned?
?
:activity
:
(
targeted?
?
:activity
:
self
.
activity
.
object_type
)
...
...
This diff is collapsed.
Click to expand it.
app/views/accounts/show.atom.ruby
+
1
−
1
View file @
7e58303a
...
...
@@ -15,7 +15,7 @@ Nokogiri::XML::Builder.new do |xml|
link_hub
xml
,
Rails
.
configuration
.
x
.
hub_url
link_salmon
xml
,
api_salmon_url
(
@account
.
id
)
@entries
.
order
(
'id desc'
).
each
do
|
stream_entry
|
@entries
.
each
do
|
stream_entry
|
entry
(
xml
,
false
)
do
include_entry
xml
,
stream_entry
end
...
...
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