DG IZ; remove authorizations from user; double check that aspect_visibilities are deleted
This commit is contained in:
parent
644e382cfd
commit
cd6f97fa0e
2 changed files with 26 additions and 1 deletions
|
|
@ -3,6 +3,18 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
class AccountDeletion
|
class AccountDeletion
|
||||||
|
|
||||||
|
# Things that are not removed from the database:
|
||||||
|
# - Comments
|
||||||
|
# - Likes
|
||||||
|
# - Messages
|
||||||
|
# - NotificationActors
|
||||||
|
#
|
||||||
|
# Given that the User in question will be tombstoned, all of the
|
||||||
|
# above will come from an anonomized account (via the UI).
|
||||||
|
# The deleted user will appear as "Deleted Account" in
|
||||||
|
# the interface.
|
||||||
|
|
||||||
attr_accessor :person, :user
|
attr_accessor :person, :user
|
||||||
|
|
||||||
def initialize(diaspora_id)
|
def initialize(diaspora_id)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'deleteing your account' do
|
describe 'deleteing your account' do
|
||||||
before :all do
|
before do
|
||||||
@bob2 = bob
|
@bob2 = bob
|
||||||
@bobs_person_id = @bob2.person.id
|
@bobs_person_id = @bob2.person.id
|
||||||
@alices_post = alice.post(:status_message, :text => "@{@bob2 Grimn; #{@bob2.person.diaspora_handle}} you are silly", :to => alice.aspects.find_by_name('generic'))
|
@alices_post = alice.post(:status_message, :text => "@{@bob2 Grimn; #{@bob2.person.diaspora_handle}} you are silly", :to => alice.aspects.find_by_name('generic'))
|
||||||
|
|
@ -12,6 +12,8 @@ describe 'deleteing your account' do
|
||||||
@bob2.post(:status_message, :text => 'asldkfjs', :to => @bob2.aspects.first)
|
@bob2.post(:status_message, :text => 'asldkfjs', :to => @bob2.aspects.first)
|
||||||
f = Factory(:photo, :author => @bob2.person)
|
f = Factory(:photo, :author => @bob2.person)
|
||||||
|
|
||||||
|
@aspect_vis = AspectVisibility.where(:aspect_id => @bob2.aspects.map(&:id))
|
||||||
|
|
||||||
#objects on post
|
#objects on post
|
||||||
@bob2.like(true, :target => @alices_post)
|
@bob2.like(true, :target => @alices_post)
|
||||||
@bob2.comment("here are some thoughts on your post", :post => @alices_post)
|
@bob2.comment("here are some thoughts on your post", :post => @alices_post)
|
||||||
|
|
@ -44,6 +46,9 @@ describe 'deleteing your account' do
|
||||||
# block
|
# block
|
||||||
@block = @bob2.blocks.create!(:person => eve.person)
|
@block = @bob2.blocks.create!(:person => eve.person)
|
||||||
|
|
||||||
|
#authorization
|
||||||
|
@authorization = Factory.create(:oauth_authorization, :resource_owner => @bob2)
|
||||||
|
|
||||||
AccountDeletion.new(@bob2.person.diaspora_handle).perform!
|
AccountDeletion.new(@bob2.person.diaspora_handle).perform!
|
||||||
@bob2.reload
|
@bob2.reload
|
||||||
end
|
end
|
||||||
|
|
@ -73,6 +78,10 @@ describe 'deleteing your account' do
|
||||||
ShareVisibility.where(:id => @persons_sv.map{|sv| sv.id}).should be_empty
|
ShareVisibility.where(:id => @persons_sv.map{|sv| sv.id}).should be_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'deletes all of @bob2s aspect visiblites' do
|
||||||
|
AspectVisibility.where(:id => @aspect_vis.map(&:id)).should be_empty
|
||||||
|
end
|
||||||
|
|
||||||
it 'deletes all photos' do
|
it 'deletes all photos' do
|
||||||
Photo.where(:author_id => @bobs_person_id).should be_empty
|
Photo.where(:author_id => @bobs_person_id).should be_empty
|
||||||
end
|
end
|
||||||
|
|
@ -89,6 +98,10 @@ describe 'deleteing your account' do
|
||||||
@bob2.contacts.should be_empty
|
@bob2.contacts.should be_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'deletes all the authorizations' do
|
||||||
|
OAuth2::Provider.authorization_class.where(:id => @authorization.id).should be_empty
|
||||||
|
end
|
||||||
|
|
||||||
it 'sets the person object as closed and the profile is cleared' do
|
it 'sets the person object as closed and the profile is cleared' do
|
||||||
@bob2.person.reload.closed_account.should be_true
|
@bob2.person.reload.closed_account.should be_true
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue