From db7d9c14bc63c5a331b7853429c214521c4c15c1 Mon Sep 17 00:00:00 2001 From: merefield Date: Sun, 24 Sep 2023 12:05:07 +0100 Subject: [PATCH] strip out redundant code from admin wizards route and controller --- .../discourse/controllers/admin-wizards.js.es6 | 13 ++++++++----- .../discourse/routes/admin-wizards.js.es6 | 13 ------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/assets/javascripts/discourse/controllers/admin-wizards.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards.js.es6 index 518893b6..ded14b91 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards.js.es6 @@ -1,9 +1,12 @@ import Controller from "@ember/controller"; -import { equal, or } from "@ember/object/computed"; +import { or } from "@ember/object/computed"; +import { inject as service } from "@ember/service"; export default Controller.extend({ - businessSubscription: equal("subscriptionType", "business"), - communitySubscription: equal("subscriptionType", "community"), - standardSubscription: equal("subscriptionType", "standard"), - showApi: or("businessSubscription", "communitySubscription"), + subscription: service(), + + showApi: or( + "subscription.businessSubscription", + "subscription.communitySubscription" + ), }); diff --git a/assets/javascripts/discourse/routes/admin-wizards.js.es6 b/assets/javascripts/discourse/routes/admin-wizards.js.es6 index 0a704434..6fc0d178 100644 --- a/assets/javascripts/discourse/routes/admin-wizards.js.es6 +++ b/assets/javascripts/discourse/routes/admin-wizards.js.es6 @@ -1,19 +1,6 @@ import DiscourseRoute from "discourse/routes/discourse"; -import { ajax } from "discourse/lib/ajax"; export default DiscourseRoute.extend({ - model() { - return ajax("/admin/wizards"); - }, - - setupController(controller, model) { - controller.setProperties({ - subscribed: model.subscribed, - subscriptionType: model.subscription_type, - subscriptionAttributes: model.subscription_attributes, - }); - }, - afterModel(model, transition) { if (transition.targetName === "adminWizards.index") { this.transitionTo("adminWizardsWizard");