diff options
author | ThibG <thib@sitedethib.com> | 2021-01-11 13:44:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-11 13:44:57 +0100 |
commit | a7a47834e50645746355e2b9a88244c1804c73cd (patch) | |
tree | 3b81b1d2a4b2c2d2e4b29948c72a7995a21fa449 /app/models/public_feed.rb | |
parent | d42e7e01dcd464f80637682d4eee6e5a7f36f26e (diff) | |
parent | 31e68bf3d35b80e794c1a44b3d60dabcf10f2a3d (diff) |
Merge pull request #1483 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models/public_feed.rb')
-rw-r--r-- | app/models/public_feed.rb | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/app/models/public_feed.rb b/app/models/public_feed.rb index 2839da5cb..2528ef1b6 100644 --- a/app/models/public_feed.rb +++ b/app/models/public_feed.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class PublicFeed < Feed +class PublicFeed # @param [Account] account # @param [Hash] options # @option [Boolean] :with_replies @@ -35,36 +35,38 @@ class PublicFeed < Feed private + attr_reader :account, :options + def allow_local_only? - local_account? && (local_only? || @options[:allow_local_only]) + local_account? && (local_only? || options[:allow_local_only]) end def with_reblogs? - @options[:with_reblogs] + options[:with_reblogs] end def with_replies? - @options[:with_replies] + options[:with_replies] end def local_only? - @options[:local] + options[:local] end def remote_only? - @options[:remote] + options[:remote] end def account? - @account.present? + account.present? end def local_account? - @account&.local? + account&.local? end def media_only? - @options[:only_media] + options[:only_media] end def public_scope @@ -96,9 +98,9 @@ class PublicFeed < Feed end def account_filters_scope - Status.not_excluded_by_account(@account).tap do |scope| - scope.merge!(Status.not_domain_blocked_by_account(@account)) unless local_only? - scope.merge!(Status.in_chosen_languages(@account)) if @account.chosen_languages.present? + Status.not_excluded_by_account(account).tap do |scope| + scope.merge!(Status.not_domain_blocked_by_account(account)) unless local_only? + scope.merge!(Status.in_chosen_languages(account)) if account.chosen_languages.present? end end end |