Add writing role for some moderation classes, update verification method.

This commit is contained in:
Fosco Marotto 2021-02-11 18:34:04 -05:00
parent 5a5150757e
commit 7a2594e105
6 changed files with 33 additions and 4 deletions

View File

@ -1,4 +1,5 @@
class Settings::Verifications::ModerationController < Admin::BaseController class Settings::Verifications::ModerationController < Admin::BaseController
def index def index
@verification_requests = AccountVerificationRequest.order('created_at DESC').all @verification_requests = AccountVerificationRequest.order('created_at DESC').all
end end
@ -10,11 +11,12 @@ class Settings::Verifications::ModerationController < Admin::BaseController
# Mark user as verified # Mark user as verified
account = verification_request.account account = verification_request.account
account.is_verified = true ApplicationRecord.transaction do
account.save() account.update!(is_verified: true)
# Remove all traces # Remove all traces
verification_request.destroy() verification_request.destroy
end
end end
# Notify user # Notify user

View File

@ -15,6 +15,11 @@ class AccountModerationNote < ApplicationRecord
belongs_to :account belongs_to :account
belongs_to :target_account, class_name: 'Account' belongs_to :target_account, class_name: 'Account'
connects_to database: {
writing: :master,
reading: :master
}
scope :latest, -> { reorder('created_at DESC') } scope :latest, -> { reorder('created_at DESC') }
validates :content, presence: true, length: { maximum: 500 } validates :content, presence: true, length: { maximum: 500 }

View File

@ -13,6 +13,12 @@
# #
class AccountVerificationRequest < ApplicationRecord class AccountVerificationRequest < ApplicationRecord
connects_to database: {
writing: :master,
reading: :master
}
LIMIT = 4.megabytes LIMIT = 4.megabytes
IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'].freeze IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'].freeze

View File

@ -29,6 +29,11 @@ class Report < ApplicationRecord
validates :comment, length: { maximum: 1000 } validates :comment, length: { maximum: 1000 }
connects_to database: {
writing: :master,
reading: :master
}
def local? def local?
false # Force uri_for to use uri attribute false # Force uri_for to use uri attribute
end end

View File

@ -18,4 +18,10 @@ class ReportNote < ApplicationRecord
scope :latest, -> { reorder(created_at: :desc) } scope :latest, -> { reorder(created_at: :desc) }
validates :content, presence: true, length: { maximum: 500 } validates :content, presence: true, length: { maximum: 500 }
connects_to database: {
writing: :master,
reading: :master
}
end end

View File

@ -23,6 +23,11 @@ class SessionActivation < ApplicationRecord
to: :access_token, to: :access_token,
allow_nil: true allow_nil: true
connects_to database: {
writing: :master,
reading: :master
}
def detection def detection
@detection ||= Browser.new(user_agent) @detection ||= Browser.new(user_agent)
end end