Fix: #950 新規アンテナ作成時にリストへ挿入するを設定しても、ホーム挿入になる (LTS) (#976)

This commit is contained in:
KMY(雪あすか) 2025-01-31 12:04:34 +09:00 committed by GitHub
parent 5e871524c0
commit 8111c1f24c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View file

@ -21,7 +21,7 @@ class Api::V1::AntennasController < Api::BaseController
end
def create
@antenna = Antenna.create!(antenna_params.merge(account: current_account, list_id: 0))
@antenna = Antenna.create!({ list_id: 0 }.merge(antenna_params.merge(account: current_account)))
render json: @antenna, serializer: REST::AntennaSerializer
end

View file

@ -120,6 +120,20 @@ RSpec.describe 'Antennas' do
expect(Antenna.where(account: user.account).count).to eq(1)
end
context 'when specify a list when create new' do
let(:list) { Fabricate(:list, account: user.account, title: 'ohagi') }
let(:params) { { title: 'my antenna', list_id: list.id.to_s, insert_feeds: 'true' } }
it 'returns the new antenna with list', :aggregate_failures do
subject
expect(response).to have_http_status(200)
expect(response.parsed_body).to match(a_hash_including(title: 'my antenna', insert_feeds: true))
expect(response.parsed_body['list']).to match(a_hash_including(id: list.id.to_s, title: list.title))
expect(Antenna.where(account: user.account).count).to eq(1)
end
end
context 'when a title is not given' do
let(:params) { { title: '' } }