From 2f206f60c7b3d76dba55cf200a18a8e66323cdaf Mon Sep 17 00:00:00 2001 From: merefield Date: Fri, 22 Sep 2023 17:08:03 +0100 Subject: [PATCH] remove redundant client installed check code --- app/controllers/custom_wizard/admin/admin.rb | 1 - .../components/wizard-subscription-status.js | 2 +- .../javascripts/discourse/mixins/subscription.js.es6 | 11 +++-------- .../javascripts/discourse/routes/admin-wizards.js.es6 | 3 +-- .../custom_wizard/admin/admin_controller_spec.rb | 2 -- test/javascripts/helpers/admin-wizard.js | 3 --- 6 files changed, 5 insertions(+), 17 deletions(-) diff --git a/app/controllers/custom_wizard/admin/admin.rb b/app/controllers/custom_wizard/admin/admin.rb index aa8862b6..cba3ac43 100644 --- a/app/controllers/custom_wizard/admin/admin.rb +++ b/app/controllers/custom_wizard/admin/admin.rb @@ -8,7 +8,6 @@ class CustomWizard::AdminController < ::Admin::AdminController subscribed: subcription.subscribed?, subscription_type: subcription.type, subscription_attributes: CustomWizard::Subscription.attributes, - subscription_client_installed: CustomWizard::Subscription.client_installed? ) end diff --git a/assets/javascripts/discourse/components/wizard-subscription-status.js b/assets/javascripts/discourse/components/wizard-subscription-status.js index 83d2b072..cdd8eb77 100644 --- a/assets/javascripts/discourse/components/wizard-subscription-status.js +++ b/assets/javascripts/discourse/components/wizard-subscription-status.js @@ -14,7 +14,7 @@ export default class WizardSubscriptionStatus extends Component { constructor() { super(...arguments); - ajax("/admin/plugins/subscription-client/suppliers").then((result) => { + ajax(${basePath}).then((result) => { this.supplierId = result.suppliers[0].id; this.authorized = result.suppliers[0].authorized; }); diff --git a/assets/javascripts/discourse/mixins/subscription.js.es6 b/assets/javascripts/discourse/mixins/subscription.js.es6 index 34276c3f..426b88a6 100644 --- a/assets/javascripts/discourse/mixins/subscription.js.es6 +++ b/assets/javascripts/discourse/mixins/subscription.js.es6 @@ -24,15 +24,10 @@ export default Mixin.create({ communitySubscription: readOnly("adminWizards.communitySubscription"), standardSubscription: readOnly("adminWizards.standardSubscription"), subscriptionAttributes: readOnly("adminWizards.subscriptionAttributes"), - subscriptionClientInstalled: readOnly( - "adminWizards.subscriptionClientInstalled" - ), - @discourseComputed("subscriptionClientInstalled") - subscriptionLink(subscriptionClientInstalled) { - return subscriptionClientInstalled - ? this.subscriptionClientUrl - : this.subscriptionLandingUrl; + @discourseComputed + subscriptionLink() { + return this.subscriptionLandingUrl; }, @discourseComputed("subscriptionType") diff --git a/assets/javascripts/discourse/routes/admin-wizards.js.es6 b/assets/javascripts/discourse/routes/admin-wizards.js.es6 index 1fa786d3..c6e728ed 100644 --- a/assets/javascripts/discourse/routes/admin-wizards.js.es6 +++ b/assets/javascripts/discourse/routes/admin-wizards.js.es6 @@ -10,8 +10,7 @@ export default DiscourseRoute.extend({ controller.setProperties({ subscribed: model.subscribed, subscriptionType: model.subscription_type, - subscriptionAttributes: model.subscription_attributes, - subscriptionClientInstalled: model.subscription_client_installed, + subscriptionAttributes: model.subscription_attributes }); }, diff --git a/spec/requests/custom_wizard/admin/admin_controller_spec.rb b/spec/requests/custom_wizard/admin/admin_controller_spec.rb index 877f4262..6fb4b0d8 100644 --- a/spec/requests/custom_wizard/admin/admin_controller_spec.rb +++ b/spec/requests/custom_wizard/admin/admin_controller_spec.rb @@ -23,7 +23,6 @@ describe CustomWizard::AdminController do get "/admin/wizards.json" expect(response.parsed_body["subscribed"]).to eq(false) expect(response.parsed_body["subscription_attributes"]).to eq(CustomWizard::Subscription.attributes.as_json) - expect(response.parsed_body["subscription_client_installed"]).to eq(true) end end @@ -37,7 +36,6 @@ describe CustomWizard::AdminController do get "/admin/wizards.json" expect(response.parsed_body["subscribed"]).to eq(true) expect(response.parsed_body["subscription_type"]).to eq("standard") - expect(response.parsed_body["subscription_client_installed"]).to eq(true) end end end diff --git a/test/javascripts/helpers/admin-wizard.js b/test/javascripts/helpers/admin-wizard.js index 6c5dd84c..5582384f 100644 --- a/test/javascripts/helpers/admin-wizard.js +++ b/test/javascripts/helpers/admin-wizard.js @@ -224,7 +224,6 @@ const getUnsubscribedAdminWizards = { all: { none: [], standard: [], business: ["*"], community: ["*"] }, }, }, - subscription_client_installed: false, }; const getCustomFields = { custom_fields: [ @@ -478,7 +477,6 @@ const getBusinessAdminWizard = { all: { none: [], standard: [], business: ["*"], community: ["*"] }, }, }, - subscription_client_installed: false, }; const getStandardAdminWizard = { subscribed: true, @@ -589,7 +587,6 @@ const getStandardAdminWizard = { all: { none: [], standard: [], business: ["*"], community: ["*"] }, }, }, - subscription_client_installed: false, }; const getAdminTestingWizard = { id: "this_is_testing_wizard",