Change lists to be able to include accounts with pending follow requests (#19727)

This commit is contained in:
Claire authored and GitHub committed 2023-05-02 14:40:36 +02:00
1 parent 598e63dad2
commit 6693a4fe7c
8 files changed
+127 -19

No files matched your search

@@ -29,17 +29,48 @@ describe Api::V1::Lists::AccountsController do
let(:scopes) { 'write:lists' }
let(:bob) { Fabricate(:account, username: 'bob') }
before do
user.account.follow!(bob)
post :create, params: { list_id: list.id, account_ids: [bob.id] }
context 'when the added account is followed' do
before do
user.account.follow!(bob)
post :create, params: { list_id: list.id, account_ids: [bob.id] }
end
it 'returns http success' do
expect(response).to have_http_status(200)
end
it 'adds account to the list' do
expect(list.accounts.include?(bob)).to be true
end
end
it 'returns http success' do
expect(response).to have_http_status(200)
context 'when the added account has been sent a follow request' do
before do
user.account.follow_requests.create!(target_account: bob)
post :create, params: { list_id: list.id, account_ids: [bob.id] }
end
it 'returns http success' do
expect(response).to have_http_status(200)
end
it 'adds account to the list' do
expect(list.accounts.include?(bob)).to be true
end
end
it 'adds account to the list' do
expect(list.accounts.include?(bob)).to be true
context 'when the added account is not followed' do
before do
post :create, params: { list_id: list.id, account_ids: [bob.id] }
end
it 'returns http not found' do
expect(response).to have_http_status(404)
end
it 'does not add the account to the list' do
expect(list.accounts.include?(bob)).to be false
end
end
end