From 26b08a3c54847f2816f78c3ac67ace001d3fea1f Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Sun, 10 May 2020 17:36:18 +0900 Subject: Add remote only to public timeline (#13504) * Add remote only to public timeline * Fix code style --- app/models/status.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'app/models') diff --git a/app/models/status.rb b/app/models/status.rb index 8c7fe8dfa..a1babf85e 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -284,7 +284,7 @@ class Status < ApplicationRecord def as_public_timeline(account = nil, local_only = false) query = timeline_scope(local_only).without_replies - apply_timeline_filters(query, account, local_only) + apply_timeline_filters(query, account, [:local, true].include?(local_only)) end def as_tag_timeline(tag, account = nil, local_only = false) @@ -376,8 +376,16 @@ class Status < ApplicationRecord private - def timeline_scope(local_only = false) - starting_scope = local_only ? Status.local : Status + def timeline_scope(scope = false) + starting_scope = case scope + when :local, true + Status.local + when :remote + Status.remote + else + Status + end + starting_scope .with_public_visibility .without_reblogs -- cgit