From 074960bb0fa59664c0ae1a35ef80301f5033700d Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 16 Nov 2018 19:34:10 +0100 Subject: [PATCH] Sort self-replies to the top of the thread (#9296) Fix #6463 --- app/models/concerns/status_threading_concern.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/concerns/status_threading_concern.rb b/app/models/concerns/status_threading_concern.rb index fa441469c1..234cfd5d24 100644 --- a/app/models/concerns/status_threading_concern.rb +++ b/app/models/concerns/status_threading_concern.rb @@ -86,6 +86,9 @@ module StatusThreadingConcern # Order ancestors/descendants by tree path statuses.sort_by! { |status| ids.index(status.id) } + + # Bring self-replies to the top + statuses.sort_by! { |status| status.in_reply_to_account_id == status.account_id ? -1 : 0 } end def relations_map_for_account(account, account_ids, domains)