From c5b8b0896f2ae2637ddca0f0a8f36a21fc3576e3 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Tue, 17 Sep 2024 17:29:38 +0200 Subject: [PATCH] only return supplier id on destroy --- .../discourse_subscription_client/suppliers_controller.rb | 2 +- .../discourse_subscription_client/suppliers_controller_spec.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/discourse_subscription_client/suppliers_controller.rb b/app/controllers/discourse_subscription_client/suppliers_controller.rb index e01600b..215484f 100644 --- a/app/controllers/discourse_subscription_client/suppliers_controller.rb +++ b/app/controllers/discourse_subscription_client/suppliers_controller.rb @@ -47,7 +47,7 @@ def authorize_callback def destroy if @supplier.destroy_authorization - render json: success_json.merge(supplier: @supplier.reload) + render json: success_json.merge(supplier_id: @supplier.id) else render json: failed_json end diff --git a/spec/requests/discourse_subscription_client/suppliers_controller_spec.rb b/spec/requests/discourse_subscription_client/suppliers_controller_spec.rb index 322d73a..a29acaf 100644 --- a/spec/requests/discourse_subscription_client/suppliers_controller_spec.rb +++ b/spec/requests/discourse_subscription_client/suppliers_controller_spec.rb @@ -84,6 +84,7 @@ delete "/admin/plugins/subscription-client/suppliers/authorize", params: { supplier_id: supplier.id } expect(response.status).to eq(200) + expect(response.parsed_body["supplier_id"]).to eq(supplier.id) expect(supplier.authorized?).to eq(false) end end