Skip to content
Snippets Groups Projects
Commit 7e00a21e authored by Eugen Rochko's avatar Eugen Rochko
Browse files

Small optimizations in Atom feeds

parent 19a25991
No related branches found
No related tags found
No related merge requests found
......@@ -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
format.atom { @entries = @account.stream_entries.order('id desc').with_includes }
end
end
......
......@@ -40,7 +40,7 @@ module AtomBuilderHelper
end
def title(xml, title)
xml.title title
xml.title strip_tags(title || '').truncate(80)
end
def author(xml, &block)
......
......@@ -46,7 +46,7 @@ class Status < ActiveRecord::Base
end
def title
content.truncate(80, omission: "...")
content
end
def reblogs_count
......
......@@ -4,6 +4,8 @@ class StreamEntry < ActiveRecord::Base
validates :account, :activity, presence: true
scope :with_includes, -> { includes(:activity) }
def object_type
orphaned? ? :activity : (targeted? ? :activity : self.activity.object_type)
end
......
......@@ -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)
@account.stream_entries.order('id desc').each do |stream_entry|
@entries.order('id desc').each do |stream_entry|
entry(xml, false) do
include_entry xml, stream_entry
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment