Fix anonymous block model associations
This commit is contained in:
parent
de9c84085d
commit
8b55b2fe81
|
@ -2,6 +2,7 @@ class Question < ApplicationRecord
|
||||||
include Question::AnswerMethods
|
include Question::AnswerMethods
|
||||||
|
|
||||||
belongs_to :user, optional: true
|
belongs_to :user, optional: true
|
||||||
|
has_many :anonymous_blocks, dependent: :nullify
|
||||||
has_many :answers, dependent: :destroy
|
has_many :answers, dependent: :destroy
|
||||||
has_many :inboxes, dependent: :destroy
|
has_many :inboxes, dependent: :destroy
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ class User < ApplicationRecord
|
||||||
has_many :lists, dependent: :destroy_async
|
has_many :lists, dependent: :destroy_async
|
||||||
has_many :list_memberships, class_name: "ListMember", dependent: :destroy_async
|
has_many :list_memberships, class_name: "ListMember", dependent: :destroy_async
|
||||||
has_many :mute_rules, dependent: :destroy_async
|
has_many :mute_rules, dependent: :destroy_async
|
||||||
has_many :anonymous_blocks, dependent: :destroy_async
|
|
||||||
|
|
||||||
has_many :subscriptions, dependent: :destroy_async
|
has_many :subscriptions, dependent: :destroy_async
|
||||||
has_many :totp_recovery_codes, dependent: :destroy_async
|
has_many :totp_recovery_codes, dependent: :destroy_async
|
||||||
|
@ -54,6 +53,11 @@ class User < ApplicationRecord
|
||||||
foreign_key: "banned_by_id",
|
foreign_key: "banned_by_id",
|
||||||
dependent: :nullify
|
dependent: :nullify
|
||||||
|
|
||||||
|
has_many :anonymous_blocks, dependent: :destroy_async
|
||||||
|
has_many :passive_anonymous_blocks, class_name: "AnonymousBlock",
|
||||||
|
foreign_key: "target_user_id",
|
||||||
|
dependent: :nullify
|
||||||
|
|
||||||
SCREEN_NAME_REGEX = /\A[a-zA-Z0-9_]+\z/
|
SCREEN_NAME_REGEX = /\A[a-zA-Z0-9_]+\z/
|
||||||
WEBSITE_REGEX = /https?:\/\/([A-Za-z.-]+)\/?(?:.*)/i
|
WEBSITE_REGEX = /https?:\/\/([A-Za-z.-]+)\/?(?:.*)/i
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue