about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-07-29 02:43:21 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:45:16 -0500
commit8a1172f163aafed9bf61d50a54a33e786ecff209 (patch)
tree15b0e4ee6aabfafdd1a9e0ea26b6c6d2c7f9b3f5 /app
parent998c8377b150a567261915df1085483dc7f82a08 (diff)
[Rails] Revise association caching
Diffstat (limited to 'app')
-rw-r--r--app/models/account_domain_permission.rb3
-rw-r--r--app/models/inline_media_attachment.rb4
-rw-r--r--app/models/status.rb1
-rw-r--r--app/models/status_domain_permission.rb3
-rw-r--r--app/models/status_mute.rb4
5 files changed, 14 insertions, 1 deletions
diff --git a/app/models/account_domain_permission.rb b/app/models/account_domain_permission.rb
index 8048c2d4a..e91a4b8cf 100644
--- a/app/models/account_domain_permission.rb
+++ b/app/models/account_domain_permission.rb
@@ -11,12 +11,15 @@
 
 class AccountDomainPermission < ApplicationRecord
   include Paginable
+  include Cacheable
 
   belongs_to :account, inverse_of: :domain_permissions
   enum visibility: [:public, :unlisted, :private, :direct, :limited], _suffix: :visibility
 
   default_scope { order(domain: :desc) }
 
+  cache_associated :account
+
   class << self
     def create_by_domains(permissions_list)
       Array(permissions_list).map(&method(:normalize)).map do |permissions|
diff --git a/app/models/inline_media_attachment.rb b/app/models/inline_media_attachment.rb
index ac4388a6d..dcf9a5ca9 100644
--- a/app/models/inline_media_attachment.rb
+++ b/app/models/inline_media_attachment.rb
@@ -9,6 +9,10 @@
 #
 
 class InlineMediaAttachment < ApplicationRecord
+  include Cacheable
+
   belongs_to :status, inverse_of: :inlined_attachments
   belongs_to :media_attachment, inverse_of: :inlines
+
+  cache_associated :status, :media_attachment
 end
diff --git a/app/models/status.rb b/app/models/status.rb
index a5f133506..7016476c0 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -136,7 +136,6 @@ class Status < ApplicationRecord
 
   cache_associated :application,
                    :media_attachments,
-                   :inlined_attachments,
                    :conversation,
                    :status_stat,
                    :tags,
diff --git a/app/models/status_domain_permission.rb b/app/models/status_domain_permission.rb
index ad38dbd52..0e72267bc 100644
--- a/app/models/status_domain_permission.rb
+++ b/app/models/status_domain_permission.rb
@@ -11,12 +11,15 @@
 
 class StatusDomainPermission < ApplicationRecord
   include Paginable
+  include Cacheable
 
   belongs_to :status, inverse_of: :domain_permissions
   enum visibility: [:public, :unlisted, :private, :direct, :limited], _suffix: :visibility
 
   default_scope { order(domain: :desc) }
 
+  cache_associated :status
+
   class << self
     def create_by_domains(permissions_list)
       Array(permissions_list).map(&method(:normalize)).map do |permissions|
diff --git a/app/models/status_mute.rb b/app/models/status_mute.rb
index 3bfd9d51f..0d7f9ec78 100644
--- a/app/models/status_mute.rb
+++ b/app/models/status_mute.rb
@@ -9,6 +9,10 @@
 #
 
 class StatusMute < ApplicationRecord
+  include Cacheable
+
   belongs_to :account, inverse_of: :status_mutes
   belongs_to :status, inverse_of: :mutes
+
+  cache_associated :account, :status
 end