Hide local statuses from user atom and from unlogged users
This commit is contained in:
parent
6bef1a8134
commit
469294d293
@ -30,7 +30,7 @@ class AccountsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
format.atom do
|
format.atom do
|
||||||
@entries = @account.stream_entries.where(hidden: false).with_includes.paginate_by_max_id(PAGE_SIZE, params[:max_id], params[:since_id])
|
@entries = @account.stream_entries.where(hidden: false).with_includes.without_local_only.paginate_by_max_id(PAGE_SIZE, params[:max_id], params[:since_id])
|
||||||
render xml: OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.feed(@account, @entries.reject { |entry| entry.status.nil? }))
|
render xml: OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.feed(@account, @entries.reject { |entry| entry.status.nil? }))
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -63,8 +63,12 @@ class AccountsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def default_statuses
|
def default_statuses
|
||||||
|
if current_user.nil?
|
||||||
|
@account.statuses.without_local_only.where(visibility: [:public, :unlisted])
|
||||||
|
else
|
||||||
@account.statuses.where(visibility: [:public, :unlisted])
|
@account.statuses.where(visibility: [:public, :unlisted])
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def only_media_scope
|
def only_media_scope
|
||||||
Status.where(id: account_media_status_ids)
|
Status.where(id: account_media_status_ids)
|
||||||
|
@ -26,6 +26,7 @@ class StreamEntry < ApplicationRecord
|
|||||||
default_scope { where(activity_type: 'Status') }
|
default_scope { where(activity_type: 'Status') }
|
||||||
scope :recent, -> { reorder(id: :desc) }
|
scope :recent, -> { reorder(id: :desc) }
|
||||||
scope :with_includes, -> { includes(:account, status: STATUS_INCLUDES) }
|
scope :with_includes, -> { includes(:account, status: STATUS_INCLUDES) }
|
||||||
|
scope :without_local_only, -> { where(statuses: { local_only: [false, nil] }) }
|
||||||
|
|
||||||
delegate :target, :title, :content, :thread, :local_only?,
|
delegate :target, :title, :content, :thread, :local_only?,
|
||||||
to: :status,
|
to: :status,
|
||||||
|
Loading…
Reference in New Issue
Block a user