mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-22 06:06:45 +00:00
Extract taggable concern
This commit is contained in:
parent
5a95c9fcc3
commit
7e68a1c8bb
|
@ -99,6 +99,7 @@ class Account < ApplicationRecord
|
|||
include DomainNormalizable
|
||||
include Paginable
|
||||
include Reviewable
|
||||
include Taggable
|
||||
|
||||
enum :protocol, { ostatus: 0, activitypub: 1 }
|
||||
enum :suspension_origin, { local: 0, remote: 1 }, prefix: true
|
||||
|
|
10
app/models/concerns/taggable.rb
Normal file
10
app/models/concerns/taggable.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Taggable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
has_many :taggings, as: :taggable, dependent: :destroy
|
||||
has_many :tags, through: :taggings
|
||||
end
|
||||
end
|
|
@ -38,6 +38,7 @@ class Status < ApplicationRecord
|
|||
include Status::SearchConcern
|
||||
include Status::SnapshotConcern
|
||||
include Status::ThreadingConcern
|
||||
include Taggable
|
||||
|
||||
MEDIA_ATTACHMENTS_LIMIT = 4
|
||||
|
||||
|
@ -84,9 +85,6 @@ class Status < ApplicationRecord
|
|||
has_many :local_reblogged, -> { merge(Account.local) }, through: :reblogs, source: :account
|
||||
has_many :local_bookmarked, -> { merge(Account.local) }, through: :bookmarks, source: :account
|
||||
|
||||
has_many :taggings, as: :taggable, dependent: :destroy
|
||||
has_many :tags, through: :taggings
|
||||
|
||||
has_one :preview_cards_status, inverse_of: :status, dependent: :delete
|
||||
|
||||
has_one :notification, as: :activity, dependent: :destroy
|
||||
|
|
Loading…
Reference in a new issue