Commit 1f0f9641 authored by 2458773093's avatar 2458773093

group posts in feed db builder

parent 213d5862
......@@ -71,6 +71,9 @@ module AccountInteractions
has_many :following, -> { order('follows.id desc') }, through: :active_relationships, source: :target_account
has_many :followers, -> { order('follows.id desc') }, through: :passive_relationships, source: :account
has_many :group_accounts, inverse_of: :account, dependent: :destroy, source: :account
has_many :groups, through: :group_accounts
# Block relationships
has_many :block_relationships, class_name: 'Block', foreign_key: 'account_id', dependent: :destroy
has_many :blocking, -> { order('blocks.id desc') }, through: :block_relationships, source: :target_account
......
......@@ -283,7 +283,7 @@ class Status < ApplicationRecord
end
def as_home_timeline(account)
where(account: [account] + account.following).where(visibility: [:public, :unlisted, :private])
where(account: [account] + account.following).or(where(group: account.groups)).where(visibility: [:public, :unlisted, :private])
end
def as_group_timeline(group)
......
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