Add requested_deletion_at attribute to Account for deleted-but-not-suspended accounts (#23617)

This commit is contained in:
Claire authored and GitHub committed 2026-07-31 13:55:33 +00:00
1 parent 1ea3bbcce8
commit ad245adf51
63 files changed
+757 -120

No files matched your search

@@ -66,5 +66,30 @@ RSpec.describe 'API V1 Accounts FollowerAccounts' do
)
end
end
context 'when request account is permanently deleted' do
before do
account.mark_deleted!
account.deletion_request.destroy
end
it 'returns http not found' do
get "/api/v1/accounts/#{account.id}/followers", params: { limit: 2 }, headers: headers
expect(response).to have_http_status(404)
end
end
context 'when request account is pending deletion' do
before do
account.mark_deleted!
end
it 'returns http not found' do
get "/api/v1/accounts/#{account.id}/followers", params: { limit: 2 }, headers: headers
expect(response).to have_http_status(404)
end
end
end
end
@@ -66,5 +66,30 @@ RSpec.describe 'API V1 Accounts FollowingAccounts' do
)
end
end
context 'when request account is permanently deleted' do
before do
account.mark_deleted!
account.deletion_request.destroy
end
it 'returns http not found' do
get "/api/v1/accounts/#{account.id}/following", params: { limit: 2 }, headers: headers
expect(response).to have_http_status(404)
end
end
context 'when request account is pending deletion' do
before do
account.mark_deleted!
end
it 'returns http not found' do
get "/api/v1/accounts/#{account.id}/following", params: { limit: 2 }, headers: headers
expect(response).to have_http_status(404)
end
end
end
end
@@ -22,4 +22,29 @@ RSpec.describe 'Accounts Lists API' do
.to start_with('application/json')
end
end
context 'when requested account is permanently deleted' do
before do
account.mark_deleted!
account.deletion_request.destroy
end
it 'returns http not found' do
get "/api/v1/accounts/#{account.id}/lists", headers: headers
expect(response).to have_http_status(404)
end
end
context 'when requested account is pending deletion' do
before do
account.mark_deleted!
end
it 'returns http not found' do
get "/api/v1/accounts/#{account.id}/lists", headers: headers
expect(response).to have_http_status(404)
end
end
end
@@ -152,5 +152,34 @@ RSpec.describe 'API V1 Accounts Statuses' do
end
end
end
context 'when requested account is permanently deleted' do
let(:account) { Fabricate(:account) }
before do
account.mark_deleted!
account.deletion_request.destroy
end
it 'returns http not found' do
get "/api/v1/accounts/#{account.id}/statuses", params: { limit: 2 }, headers: headers
expect(response).to have_http_status(404)
end
end
context 'when requested account is pending deletion' do
let(:account) { Fabricate(:account) }
before do
account.mark_deleted!
end
it 'returns http not found' do
get "/api/v1/accounts/#{account.id}/statuses", params: { limit: 2 }, headers: headers
expect(response).to have_http_status(404)
end
end
end
end
+25
View File
@@ -48,6 +48,31 @@ RSpec.describe '/api/v1/accounts' do
end
end
context 'when requesting a permanently deleted account' do
let(:other_account) { Fabricate(:account, requested_deletion: true) }
before do
get "/api/v1/accounts/#{other_account.id}"
end
it 'returns http not found' do
expect(response).to have_http_status(404)
end
end
context 'when requesting an account pending deletion' do
let(:other_account) { Fabricate(:account) }
before do
other_account.mark_deleted!
get "/api/v1/accounts/#{other_account.id}"
end
it 'returns http not found' do
expect(response).to have_http_status(404)
end
end
context 'when logged in' do
subject do
get "/api/v1/accounts/#{account.id}", headers: headers