Added new spam_flag to Accounts, replacing is_flagged_as_spam

• Added:
- new spam_flag to Accounts, replacing is_flagged_as_spam
- null/0: no spam, 1: spam, 2: safe from spam

• Updated:
- Comment, Status to reflect changes

• Todo:
- Fully remove is_flagged_as_spam
- Update SortingQueryBuilder
This commit is contained in:
Developer
2021-02-18 23:46:53 -05:00
parent bf1d00b5f8
commit 2a8ca2cd56
13 changed files with 34 additions and 12 deletions

View File

@@ -174,7 +174,7 @@ module Admin
end
def reset_spam
@account.is_flagged_as_spam = false
@account.spam_flag = Account::SPAM_FLAG_CLASS_MAP[:safe]
@account.save!
redirect_to admin_account_path(@account.id)
end

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.nil? and current_user.account.is_flagged_as_spam?
elsif !current_user.account.nil? and current_user.account.is_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