about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-08-21 19:54:21 +0200
committerGitHub <noreply@github.com>2018-08-21 19:54:21 +0200
commit37965ac8d9773ae79f6b8dd6fcd353894d2194ca (patch)
tree51f194442d2ec7ab760b443b98c7685f64481ca7 /app/models
parentc78918162642649ce294d89effbf2e815c2aa327 (diff)
parent8b4abaa90d8dff64525d92c3ba1c750356608240 (diff)
Merge pull request #660 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models')
-rw-r--r--app/models/account_pin.rb1
-rw-r--r--app/models/form/status_batch.rb4
-rw-r--r--app/models/notification.rb6
-rw-r--r--app/models/status.rb2
4 files changed, 7 insertions, 6 deletions
diff --git a/app/models/account_pin.rb b/app/models/account_pin.rb
index 9a21c3405..b51d3d4cd 100644
--- a/app/models/account_pin.rb
+++ b/app/models/account_pin.rb
@@ -11,6 +11,7 @@
 #
 
 class AccountPin < ApplicationRecord
+  include Paginable
   include RelationshipCacheable
 
   belongs_to :account
diff --git a/app/models/form/status_batch.rb b/app/models/form/status_batch.rb
index 4f08a3049..8f5fd1fa2 100644
--- a/app/models/form/status_batch.rb
+++ b/app/models/form/status_batch.rb
@@ -23,7 +23,7 @@ class Form::StatusBatch
     media_attached_status_ids = MediaAttachment.where(status_id: status_ids).pluck(:status_id)
 
     ApplicationRecord.transaction do
-      Status.where(id: media_attached_status_ids).find_each do |status|
+      Status.where(id: media_attached_status_ids).reorder(nil).find_each do |status|
         status.update!(sensitive: sensitive)
         log_action :update, status
       end
@@ -35,7 +35,7 @@ class Form::StatusBatch
   end
 
   def delete_statuses
-    Status.where(id: status_ids).find_each do |status|
+    Status.where(id: status_ids).reorder(nil).find_each do |status|
       RemovalWorker.perform_async(status.id)
       log_action :destroy, status
     end
diff --git a/app/models/notification.rb b/app/models/notification.rb
index 4f6ec8e8e..b9bec0808 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -39,8 +39,6 @@ class Notification < ApplicationRecord
   validates :account_id, uniqueness: { scope: [:activity_type, :activity_id] }
   validates :activity_type, inclusion: { in: TYPE_CLASS_MAP.values }
 
-  scope :cache_ids, -> { select(:id, :updated_at, :activity_type, :activity_id) }
-
   scope :browserable, ->(exclude_types = []) {
     types = TYPE_CLASS_MAP.values - activity_types_from_types(exclude_types + [:follow_request])
     where(activity_type: types)
@@ -68,6 +66,10 @@ class Notification < ApplicationRecord
   end
 
   class << self
+    def cache_ids
+      select(:id, :updated_at, :activity_type, :activity_id)
+    end
+
     def reload_stale_associations!(cached_items)
       account_ids = (cached_items.map(&:from_account_id) + cached_items.map { |item| item.target_status&.account_id }.compact).uniq
 
diff --git a/app/models/status.rb b/app/models/status.rb
index 8cd6d3862..f38227b85 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -26,8 +26,6 @@
 #
 
 class Status < ApplicationRecord
-  self.cache_versioning = false
-
   include Paginable
   include Streamable
   include Cacheable