Add a nil check during require_user

This commit is contained in:
Fosco Marotto 2021-02-17 00:20:06 -05:00
parent 8d3d7efe34
commit 6b7ece9123

View File

@ -87,7 +87,7 @@ class Api::BaseController < ApplicationController
# : todo : when figure out email/catpcha, put this back
# elsif !current_user.confirmed?
# render json: { error: 'Your login is missing a confirmed e-mail address' }, status: 403
elsif current_user.account.is_flagged_as_spam?
elsif !current_user.account.nil? and current_user.account.is_flagged_as_spam?
render json: { error: 'Your account has been flagged as spam. Please contact support@gab.com if you believe this is an error.' }, status: 403
elsif !current_user.approved?
render json: { error: 'Your login is currently pending approval' }, status: 403