From 2d5a103176aace6a926e05fe859767c596a98530 Mon Sep 17 00:00:00 2001 From: noellabo Date: Sun, 30 Aug 2020 22:49:09 +0900 Subject: [PATCH] Add group own post to group timeline --- app/models/concerns/account_associations.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/concerns/account_associations.rb b/app/models/concerns/account_associations.rb index 8fd2976ac..a544f70c6 100644 --- a/app/models/concerns/account_associations.rb +++ b/app/models/concerns/account_associations.rb @@ -88,11 +88,13 @@ module AccountAssociations visibility = [:public, :unlisted] visibility.push(:private) if account&.following?(self) - scope = Status.where(id: - Status.where(account_id: id) + scope = Status.unscoped + .where(id: + Status.reorder(nil) + .where(account_id: id) .where(visibility: visibility) - .select(:reblog_of_id) - ) + .select('CASE reblog_of_id WHEN NULL THEN id ELSE reblog_of_id END') + ) scope = scope.where.not(account_id: account.excluded_from_timeline_account_ids) unless account.nil? scope end