diff options
Diffstat (limited to 'app/presenters')
-rw-r--r-- | app/presenters/activitypub/collection_presenter.rb | 2 | ||||
-rw-r--r-- | app/presenters/instance_presenter.rb | 6 | ||||
-rw-r--r-- | app/presenters/status_relationships_presenter.rb | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/app/presenters/activitypub/collection_presenter.rb b/app/presenters/activitypub/collection_presenter.rb index 631d87cd0..39657276f 100644 --- a/app/presenters/activitypub/collection_presenter.rb +++ b/app/presenters/activitypub/collection_presenter.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true class ActivityPub::CollectionPresenter < ActiveModelSerializers::Model - attributes :id, :type, :size, :items + attributes :id, :type, :size, :items, :part_of, :first, :next, :prev end diff --git a/app/presenters/instance_presenter.rb b/app/presenters/instance_presenter.rb index b1afb9e1f..1c08fb3bc 100644 --- a/app/presenters/instance_presenter.rb +++ b/app/presenters/instance_presenter.rb @@ -21,7 +21,7 @@ class InstancePresenter end def status_count - Rails.cache.fetch('local_status_count') { Status.local.count } + Rails.cache.fetch('local_status_count') { Account.local.sum(:statuses_count) } end def domain_count @@ -44,4 +44,8 @@ class InstancePresenter def source_url Mastodon::Version.source_url end + + def thumbnail + @thumbnail ||= Rails.cache.fetch('site_uploads/thumbnail') { SiteUpload.find_by(var: 'thumbnail') } + end end diff --git a/app/presenters/status_relationships_presenter.rb b/app/presenters/status_relationships_presenter.rb index 10b449504..bc3887a44 100644 --- a/app/presenters/status_relationships_presenter.rb +++ b/app/presenters/status_relationships_presenter.rb @@ -11,7 +11,7 @@ class StatusRelationshipsPresenter @pins_map = {} else statuses = statuses.compact - status_ids = statuses.flat_map { |s| [s.id, s.reblog_of_id] }.uniq + status_ids = statuses.flat_map { |s| [s.id, s.reblog_of_id] }.uniq.compact conversation_ids = statuses.map(&:conversation_id).compact.uniq pinnable_status_ids = statuses.map(&:proper).select { |s| s.account_id == current_account_id && %w(public unlisted).include?(s.visibility) }.map(&:id) |