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

View File

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

View File

@ -13,6 +13,12 @@
#
class AccountVerificationRequest < ApplicationRecord
connects_to database: {
writing: :master,
reading: :master
}
LIMIT = 4.megabytes
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 }
connects_to database: {
writing: :master,
reading: :master
}
def local?
false # Force uri_for to use uri attribute
end

View File

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

View File

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