Commit 98a52274 authored by yakitama's avatar yakitama

ハッシュタグカラムに unlisted なトゥートを表示するように変更

parent c4118ba7
......@@ -85,6 +85,7 @@ class Status < ApplicationRecord
scope :without_replies, -> { where('statuses.reply = FALSE OR statuses.in_reply_to_account_id = statuses.account_id') }
scope :without_reblogs, -> { where('statuses.reblog_of_id IS NULL') }
scope :with_public_visibility, -> { where(visibility: :public) }
scope :with_unlisted_visibility, -> { where(visibility: [:public, :unlisted]) }
scope :tagged_with, ->(tag) { joins(:statuses_tags).where(statuses_tags: { tag_id: tag }) }
scope :excluding_silenced_accounts, -> { left_outer_joins(:account).where(accounts: { silenced_at: nil }) }
scope :including_silenced_accounts, -> { left_outer_joins(:account).where.not(accounts: { silenced_at: nil }) }
......@@ -289,7 +290,7 @@ class Status < ApplicationRecord
end
def as_tag_timeline(tag, account = nil, local_only = false)
query = timeline_scope(local_only).tagged_with(tag)
query = hashtag_timeline_scope(local_only).tagged_with(tag)
apply_timeline_filters(query, account, local_only)
end
......@@ -365,6 +366,13 @@ class Status < ApplicationRecord
.without_reblogs
end
def hashtag_timeline_scope(local_only = false)
starting_scope = local_only ? Status.local : Status
starting_scope
.with_unlisted_visibility
.without_reblogs
end
def apply_timeline_filters(query, account, local_only)
if account.nil?
filter_timeline_default(query)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment