Verification requests should use the writing role

This commit is contained in:
Fosco Marotto 2021-02-11 01:18:36 -05:00
parent 538bcf21c9
commit 4bb2f1b745
1 changed files with 16 additions and 11 deletions

View File

@ -4,26 +4,31 @@ class Settings::Verifications::ModerationController < Admin::BaseController
end end
def approve def approve
verification_request = AccountVerificationRequest.find(params[:id])
ActiveRecord::Base.connected_to(role: :writing) do
# Mark user as verified verification_request = AccountVerificationRequest.find(params[:id])
account = verification_request.account
account.is_verified = true # Mark user as verified
account.save() account = verification_request.account
account.is_verified = true
account.save()
# Remove all traces
verification_request.destroy()
end
# Notify user # Notify user
UserMailer.verification_approved(account.user).deliver_later! UserMailer.verification_approved(account.user).deliver_later!
# Remove all traces
verification_request.destroy()
# Redirect back to the form with a proper message # Redirect back to the form with a proper message
redirect_to settings_verifications_moderation_url, notice: I18n.t('verifications.moderation.approved_msg') redirect_to settings_verifications_moderation_url, notice: I18n.t('verifications.moderation.approved_msg')
end end
def reject def reject
verification_request = AccountVerificationRequest.find(params[:id]) ActiveRecord::Base.connected_to(role: :writing) do
verification_request.destroy() verification_request = AccountVerificationRequest.find(params[:id])
verification_request.destroy()
end
redirect_to settings_verifications_moderation_url, notice: I18n.t('verifications.moderation.rejected_msg') redirect_to settings_verifications_moderation_url, notice: I18n.t('verifications.moderation.rejected_msg')
end end
end end