From 45f52d56c0cb01c452d16e047c3d482320908f85 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Fri, 13 May 2022 12:04:53 +0200 Subject: [PATCH] Sort actions by subscription type --- .../components/wizard-subscription-selector.js.es6 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/assets/javascripts/discourse/components/wizard-subscription-selector.js.es6 b/assets/javascripts/discourse/components/wizard-subscription-selector.js.es6 index 2202f746..d6db8875 100644 --- a/assets/javascripts/discourse/components/wizard-subscription-selector.js.es6 +++ b/assets/javascripts/discourse/components/wizard-subscription-selector.js.es6 @@ -67,6 +67,18 @@ export default SingleSelectComponent.extend(Subscription, { requiredSubscriptionType ), }; + }).sort(function(a, b) { + if (a.subscriptionType && !b.subscriptionType) { + return 1; + } + if (!a.subscriptionType && b.subscriptionType) { + return -1; + } + if (a.subscriptionType == b.subscriptionType) { + return a.subscriptionType ? a.subscriptionType.localeCompare(b.subscriptionType) : 0; + } else { + return a.subscriptionType === 'standard' ? -1 : 0; + } }); },