about summary refs log tree commit diff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-11-12 13:28:03 +0100
committerClaire <claire.github-309c@sitedethib.com>2022-11-12 13:28:03 +0100
commit93912f04988eab072a119a588342c68c5cdb52e0 (patch)
tree815a69053ed9f1eb5e86e62735220a53bfcef814 /app/models/concerns
parentd37f426f95f812b44925e13c00eabb9d1cd76b1f (diff)
parentd26c1cb2fe145b8d56a9c15e110a917e6f63068b (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `app/models/account.rb`:
  Conflict because we (glitch-soc) have disabled trending of posts without
  review.
  Discarded that upstream change.
- `app/views/admin/settings/discovery/show.html.haml`:
  Just an extra setting in glitch-soc.
  Kept that extra setting.
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/account_avatar.rb2
-rw-r--r--app/models/concerns/account_header.rb2
-rw-r--r--app/models/concerns/status_threading_concern.rb21
3 files changed, 10 insertions, 15 deletions
diff --git a/app/models/concerns/account_avatar.rb b/app/models/concerns/account_avatar.rb
index 0cfd9167c..e9b8b4adb 100644
--- a/app/models/concerns/account_avatar.rb
+++ b/app/models/concerns/account_avatar.rb
@@ -18,7 +18,7 @@ module AccountAvatar
 
   included do
     # Avatar upload
-    has_attached_file :avatar, styles: ->(f) { avatar_styles(f) }, convert_options: { all: '-strip' }, processors: [:lazy_thumbnail]
+    has_attached_file :avatar, styles: ->(f) { avatar_styles(f) }, convert_options: { all: '+profile "!icc,*" +set modify-date +set create-date' }, processors: [:lazy_thumbnail]
     validates_attachment_content_type :avatar, content_type: IMAGE_MIME_TYPES
     validates_attachment_size :avatar, less_than: LIMIT
     remotable_attachment :avatar, LIMIT, suppress_errors: false
diff --git a/app/models/concerns/account_header.rb b/app/models/concerns/account_header.rb
index a8c0a28ef..0d197abfc 100644
--- a/app/models/concerns/account_header.rb
+++ b/app/models/concerns/account_header.rb
@@ -19,7 +19,7 @@ module AccountHeader
 
   included do
     # Header upload
-    has_attached_file :header, styles: ->(f) { header_styles(f) }, convert_options: { all: '-strip' }, processors: [:lazy_thumbnail]
+    has_attached_file :header, styles: ->(f) { header_styles(f) }, convert_options: { all: '+profile "!icc,*" +set modify-date +set create-date' }, processors: [:lazy_thumbnail]
     validates_attachment_content_type :header, content_type: IMAGE_MIME_TYPES
     validates_attachment_size :header, less_than: LIMIT
     remotable_attachment :header, LIMIT, suppress_errors: false
diff --git a/app/models/concerns/status_threading_concern.rb b/app/models/concerns/status_threading_concern.rb
index 5c04108e4..8b628beea 100644
--- a/app/models/concerns/status_threading_concern.rb
+++ b/app/models/concerns/status_threading_concern.rb
@@ -7,8 +7,8 @@ module StatusThreadingConcern
     find_statuses_from_tree_path(ancestor_ids(limit), account)
   end
 
-  def descendants(limit, account = nil, max_child_id = nil, since_child_id = nil, depth = nil)
-    find_statuses_from_tree_path(descendant_ids(limit, max_child_id, since_child_id, depth), account, promote: true)
+  def descendants(limit, account = nil, depth = nil)
+    find_statuses_from_tree_path(descendant_ids(limit, depth), account, promote: true)
   end
 
   def self_replies(limit)
@@ -50,22 +50,17 @@ module StatusThreadingConcern
     SQL
   end
 
-  def descendant_ids(limit, max_child_id, since_child_id, depth)
-    descendant_statuses(limit, max_child_id, since_child_id, depth).pluck(:id)
-  end
-
-  def descendant_statuses(limit, max_child_id, since_child_id, depth)
+  def descendant_ids(limit, depth)
     # use limit + 1 and depth + 1 because 'self' is included
     depth += 1 if depth.present?
     limit += 1 if limit.present?
 
-    descendants_with_self = Status.find_by_sql([<<-SQL.squish, id: id, limit: limit, max_child_id: max_child_id, since_child_id: since_child_id, depth: depth])
-      WITH RECURSIVE search_tree(id, path)
-      AS (
+    descendants_with_self = Status.find_by_sql([<<-SQL.squish, id: id, limit: limit, depth: depth])
+      WITH RECURSIVE search_tree(id, path) AS (
         SELECT id, ARRAY[id]
         FROM statuses
-        WHERE id = :id AND COALESCE(id < :max_child_id, TRUE) AND COALESCE(id > :since_child_id, TRUE)
-        UNION ALL
+        WHERE id = :id
+      UNION ALL
         SELECT statuses.id, path || statuses.id
         FROM search_tree
         JOIN statuses ON statuses.in_reply_to_id = search_tree.id
@@ -77,7 +72,7 @@ module StatusThreadingConcern
       LIMIT :limit
     SQL
 
-    descendants_with_self - [self]
+    descendants_with_self.pluck(:id) - [id]
   end
 
   def find_statuses_from_tree_path(ids, account, promote: false)