* Fix: #950 新規アンテナ作成時にリストへ挿入するを設定しても、ホーム挿入になる * Fix test
This commit is contained in:
parent
80cace410f
commit
915ee553da
7 changed files with 27 additions and 5 deletions
|
@ -21,7 +21,7 @@ class Api::V1::AntennasController < Api::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@antenna = Antenna.create!(antenna_params.merge(account: current_account, list_id: 0))
|
@antenna = Antenna.create!(antenna_params.merge(account: current_account))
|
||||||
render json: @antenna, serializer: REST::AntennaSerializer
|
render json: @antenna, serializer: REST::AntennaSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ const NewAntenna: React.FC<{
|
||||||
const [stl, setStl] = useState(false);
|
const [stl, setStl] = useState(false);
|
||||||
const [ltl, setLtl] = useState(false);
|
const [ltl, setLtl] = useState(false);
|
||||||
const [insertFeeds, setInsertFeeds] = useState(false);
|
const [insertFeeds, setInsertFeeds] = useState(false);
|
||||||
const [listId, setListId] = useState('');
|
const [listId, setListId] = useState('0');
|
||||||
const [withMediaOnly, setWithMediaOnly] = useState(false);
|
const [withMediaOnly, setWithMediaOnly] = useState(false);
|
||||||
const [ignoreReblog, setIgnoreReblog] = useState(false);
|
const [ignoreReblog, setIgnoreReblog] = useState(false);
|
||||||
const [mode, setMode] = useState('filtering');
|
const [mode, setMode] = useState('filtering');
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
# created_at :datetime not null
|
# created_at :datetime not null
|
||||||
# updated_at :datetime not null
|
# updated_at :datetime not null
|
||||||
# account_id :bigint(8) not null
|
# account_id :bigint(8) not null
|
||||||
# list_id :bigint(8) not null
|
# list_id :bigint(8) default(0), not null
|
||||||
#
|
#
|
||||||
class Antenna < ApplicationRecord
|
class Antenna < ApplicationRecord
|
||||||
include Expireable
|
include Expireable
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class SetAntennaListIdDefaultValue < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
change_column_default :antennas, :list_id, from: nil, to: 0
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[8.0].define(version: 2025_01_23_091137) do
|
ActiveRecord::Schema[8.0].define(version: 2025_01_30_232529) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "pg_catalog.plpgsql"
|
enable_extension "pg_catalog.plpgsql"
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_01_23_091137) do
|
||||||
|
|
||||||
create_table "antennas", force: :cascade do |t|
|
create_table "antennas", force: :cascade do |t|
|
||||||
t.bigint "account_id", null: false
|
t.bigint "account_id", null: false
|
||||||
t.bigint "list_id", null: false
|
t.bigint "list_id", default: 0, null: false
|
||||||
t.string "title", default: "", null: false
|
t.string "title", default: "", null: false
|
||||||
t.jsonb "keywords"
|
t.jsonb "keywords"
|
||||||
t.jsonb "exclude_keywords"
|
t.jsonb "exclude_keywords"
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace :dangerous do
|
||||||
end
|
end
|
||||||
|
|
||||||
target_migrations = %w(
|
target_migrations = %w(
|
||||||
|
20250130232529
|
||||||
20250123091137
|
20250123091137
|
||||||
20241208232829
|
20241208232829
|
||||||
20240828123604
|
20240828123604
|
||||||
|
|
|
@ -123,6 +123,20 @@ RSpec.describe 'Antennas' do
|
||||||
expect(Antenna.where(account: user.account).count).to eq(1)
|
expect(Antenna.where(account: user.account).count).to eq(1)
|
||||||
end
|
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
|
context 'when a title is not given' do
|
||||||
let(:params) { { title: '' } }
|
let(:params) { { title: '' } }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue