A podmin can now disable a spam account from the interface.
This commit is contained in:
parent
5a3d329703
commit
cc53e1762b
4 changed files with 22 additions and 0 deletions
|
|
@ -10,6 +10,12 @@ class AdminsController < ApplicationController
|
|||
@users ||= []
|
||||
end
|
||||
|
||||
def remove_spammer
|
||||
user = User.find(params[:user_id])
|
||||
user.close_account!
|
||||
redirect_to root_url, notice:"this account will be deleted in a few moments"
|
||||
end
|
||||
|
||||
def admin_inviter
|
||||
inviter = InvitationCode.default_inviter_or(current_user)
|
||||
email = params[:identifier]
|
||||
|
|
|
|||
|
|
@ -90,3 +90,7 @@
|
|||
|
||||
%br
|
||||
%br
|
||||
|
||||
|
||||
- if current_user.admin? && person.owner.present?
|
||||
= link_to 'Disable Account', remove_spammer_path(user_id:person.owner.id), method: :delete, data:{confirm:'Are you sure you want to disable this account? It will delete all data associated.'}
|
||||
|
|
@ -128,6 +128,7 @@ Diaspora::Application.routes.draw do
|
|||
get :admin_inviter
|
||||
get :weekly_user_stats
|
||||
get :correlations
|
||||
delete :remove_spammer
|
||||
get :stats, :as => 'pod_stats'
|
||||
get "add_invites/:invite_code_id" => 'admins#add_invites', :as => 'add_invites'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -103,6 +103,17 @@ describe AdminsController do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#remove_spammer' do
|
||||
it 'it queues a job to disable the given account' do
|
||||
|
||||
other_user = FactoryGirl.create :user
|
||||
|
||||
User.stub(:find).and_return(other_user)
|
||||
delete :remove_spammer, user_id: other_user.id
|
||||
other_user.should_receive(:close_account)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#stats' do
|
||||
before do
|
||||
Role.add_admin(@user.person)
|
||||
|
|
|
|||
Loading…
Reference in a new issue