diff --git a/app/controllers/settings/verifications/moderation_controller.rb b/app/controllers/settings/verifications/moderation_controller.rb index d18c272d..81644084 100644 --- a/app/controllers/settings/verifications/moderation_controller.rb +++ b/app/controllers/settings/verifications/moderation_controller.rb @@ -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 diff --git a/app/models/account_moderation_note.rb b/app/models/account_moderation_note.rb index 22e312bb..c3e8c253 100644 --- a/app/models/account_moderation_note.rb +++ b/app/models/account_moderation_note.rb @@ -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 } diff --git a/app/models/account_verification_request.rb b/app/models/account_verification_request.rb index 75896dbc..7fb3b0a4 100644 --- a/app/models/account_verification_request.rb +++ b/app/models/account_verification_request.rb @@ -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 diff --git a/app/models/report.rb b/app/models/report.rb index 5d43d9b1..71f8ff7e 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -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 diff --git a/app/models/report_note.rb b/app/models/report_note.rb index 6d7167e0..fa330f2a 100644 --- a/app/models/report_note.rb +++ b/app/models/report_note.rb @@ -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 diff --git a/app/models/session_activation.rb b/app/models/session_activation.rb index 58a6495c..ae9374e7 100644 --- a/app/models/session_activation.rb +++ b/app/models/session_activation.rb @@ -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