From 01df29196980d204ea10a6eca5c82f0e45a88872 Mon Sep 17 00:00:00 2001 From: aseroff Date: Thu, 21 May 2026 16:11:24 -0500 Subject: [PATCH 1/4] Allow embeddables to be blank to support embeddables without any attributes --- .../spina/admin/embeds_controller.rb | 2 +- .../spina/admin/embeds_controller_test.rb | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 test/functional/spina/admin/embeds_controller_test.rb diff --git a/app/controllers/spina/admin/embeds_controller.rb b/app/controllers/spina/admin/embeds_controller.rb index 814dd5c2b..58d3e8578 100644 --- a/app/controllers/spina/admin/embeds_controller.rb +++ b/app/controllers/spina/admin/embeds_controller.rb @@ -27,7 +27,7 @@ def embed_type end def embed_params - params.require(:embeddable).permit! + params.permit(:embeddable).fetch(:embeddable, {}) end end end diff --git a/test/functional/spina/admin/embeds_controller_test.rb b/test/functional/spina/admin/embeds_controller_test.rb new file mode 100644 index 000000000..d4eb3fde2 --- /dev/null +++ b/test/functional/spina/admin/embeds_controller_test.rb @@ -0,0 +1,33 @@ +require "test_helper" + +module Spina + module Admin + class EmbedsControllerTest < ActionController::TestCase + setup do + @routes = Spina::Engine.routes + @account = FactoryBot.create(:account) + @user = FactoryBot.create(:user) + sign_in @user + end + + test "should work with normal nested embeddable params" do + post :create, params: { + embed_type: "Spina::Embeds::YouTube", + embeddable: { + url: "https://www.youtube.com/watch?v=dQw4w9wgxcq" + } + }, format: :turbo_stream + + assert_response :success + end + + test "should create embeddable with no attributes (no embeddable param sent)" do + post :create, params: { + embed_type: "Spina::Embeds::YouTube" + }, format: :turbo_stream + + assert_response :success + end + end + end +end \ No newline at end of file From 3fafc6b4aeed5e0f1d4df3fde9572b98114f40c9 Mon Sep 17 00:00:00 2001 From: aseroff Date: Thu, 21 May 2026 16:17:07 -0500 Subject: [PATCH 2/4] Update embeds_controller.rb --- app/controllers/spina/admin/embeds_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/spina/admin/embeds_controller.rb b/app/controllers/spina/admin/embeds_controller.rb index 58d3e8578..081924f81 100644 --- a/app/controllers/spina/admin/embeds_controller.rb +++ b/app/controllers/spina/admin/embeds_controller.rb @@ -27,7 +27,7 @@ def embed_type end def embed_params - params.permit(:embeddable).fetch(:embeddable, {}) + params.permit(embeddable: {}).fetch(:embeddable, {}) end end end From 8cde42fe9c81cb86ff7b2fabb086963e100013be Mon Sep 17 00:00:00 2001 From: aseroff Date: Fri, 22 May 2026 07:53:43 -0500 Subject: [PATCH 3/4] Update embeds_controller_test.rb --- test/functional/spina/admin/embeds_controller_test.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/test/functional/spina/admin/embeds_controller_test.rb b/test/functional/spina/admin/embeds_controller_test.rb index d4eb3fde2..eb7ff95d2 100644 --- a/test/functional/spina/admin/embeds_controller_test.rb +++ b/test/functional/spina/admin/embeds_controller_test.rb @@ -7,7 +7,6 @@ class EmbedsControllerTest < ActionController::TestCase @routes = Spina::Engine.routes @account = FactoryBot.create(:account) @user = FactoryBot.create(:user) - sign_in @user end test "should work with normal nested embeddable params" do From 342f084865f89ce5e13de5b9fe08a83283d62452 Mon Sep 17 00:00:00 2001 From: aseroff Date: Fri, 22 May 2026 07:57:45 -0500 Subject: [PATCH 4/4] Update embeds_controller_test.rb --- test/functional/spina/admin/embeds_controller_test.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/functional/spina/admin/embeds_controller_test.rb b/test/functional/spina/admin/embeds_controller_test.rb index eb7ff95d2..0e1ca7401 100644 --- a/test/functional/spina/admin/embeds_controller_test.rb +++ b/test/functional/spina/admin/embeds_controller_test.rb @@ -7,6 +7,7 @@ class EmbedsControllerTest < ActionController::TestCase @routes = Spina::Engine.routes @account = FactoryBot.create(:account) @user = FactoryBot.create(:user) + @controller.stubs(:current_spina_user).returns(@user) end test "should work with normal nested embeddable params" do