mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
some anti-spam measures
This commit is contained in:
parent
cfce4595b7
commit
5ae70beaeb
@ -98,6 +98,7 @@ class UsersController < ApplicationController
|
||||
@user = User.find_by(user_params)
|
||||
return redirect_to(root_path, notice: 'That user does not exist.') if @user.nil?
|
||||
return redirect_to(root_path, notice: 'That user has chosen to hide their profile.') if @user.private_profile?
|
||||
return redirect_to(root_path, notice: 'That user has had their profile hidden.') if @user.thredded_user_detail.moderation_state == 'blocked'
|
||||
|
||||
@accent_color = @user.favorite_page_type_color
|
||||
@accent_icon = @user.favorite_page_type_icon
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
class ShareComment < ApplicationRecord
|
||||
acts_as_paranoid
|
||||
|
||||
belongs_to :user, optional: true
|
||||
belongs_to :user, optional: true # now that we're auto-deleting this data, we can probably remove this constraint without db errors
|
||||
belongs_to :content_page_share
|
||||
|
||||
def from_op?(share)
|
||||
|
||||
@ -3,6 +3,12 @@ namespace :daily do
|
||||
task clear_thredded_spam: :environment do
|
||||
Thredded::Post.where(moderation_state: "blocked").destroy_all
|
||||
Thredded::Topic.where(moderation_state: "blocked").destroy_all
|
||||
|
||||
blocked_user_ids = Thredded::UserDetail.where(moderation_state: "blocked").pluck(:user_id)
|
||||
|
||||
# Destroy all stream comments from blocked users and nil users
|
||||
ShareComment.where(user_id: blocked_user_ids).destroy_all
|
||||
ShareComment.where(user_id: nil).destroy_all
|
||||
end
|
||||
|
||||
desc "Run end-of-day-analytics reporter"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user