Skip to content

Commit

Permalink
Merge branch 'kb-emergency-release-5.3-lts' into kb-draft-5.3-lts
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Oct 8, 2023
2 parents f6b583a + b8d2a30 commit 2c0aa43
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/statuses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def context

ancestors_results = @status.in_reply_to_id.nil? ? [] : @status.ancestors(ancestors_limit, current_account)
descendants_results = @status.descendants(descendants_limit, current_account, descendants_depth_limit)
references_results = @status.references
references_results = @status.readable_references(current_account)
loaded_ancestors = cache_collection(ancestors_results, Status)
loaded_descendants = cache_collection(descendants_results, Status)
loaded_references = cache_collection(references_results, Status)
Expand Down
9 changes: 9 additions & 0 deletions app/models/concerns/status_threading_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ def descendants(limit, account = nil, depth = nil)
find_statuses_from_tree_path(descendant_ids(limit, depth), account, promote: true)
end

def readable_references(account = nil)
statuses = references.to_a
account_ids = statuses.map(&:account_id).uniq
domains = statuses.filter_map(&:account_domain).uniq
relations = account&.relations_map(account_ids, domains) || {}
statuses.reject! { |status| StatusFilter.new(status, account, relations).filtered? }
statuses
end

def self_replies(limit)
account.statuses.where(in_reply_to_id: id, visibility: [:public, :unlisted, :public_unlisted, :login]).reorder(id: :asc).limit(limit)
end
Expand Down

0 comments on commit 2c0aa43

Please sign in to comment.