diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/account_domain_permission.rb | 3 | ||||
-rw-r--r-- | app/models/inline_media_attachment.rb | 4 | ||||
-rw-r--r-- | app/models/status.rb | 1 | ||||
-rw-r--r-- | app/models/status_domain_permission.rb | 3 | ||||
-rw-r--r-- | app/models/status_mute.rb | 4 |
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 |