about summary refs log tree commit diff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-11-16 19:34:10 +0100
committerGitHub <noreply@github.com>2018-11-16 19:34:10 +0100
commit074960bb0fa59664c0ae1a35ef80301f5033700d (patch)
tree2465d2bf6bc7fdc959c11ea977f47441a9b2a406 /app/models/concerns
parent8069fd636ba14059524303ce76abe2173c4f3d01 (diff)
Sort self-replies to the top of the thread (#9296)
Fix #6463
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/status_threading_concern.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/concerns/status_threading_concern.rb b/app/models/concerns/status_threading_concern.rb
index fa441469c..234cfd5d2 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)