diff --git a/app/assets/javascripts/discourse/config/deprecation-workflow.js b/app/assets/javascripts/discourse/config/deprecation-workflow.js index bbf0feb10dd..23e96363920 100644 --- a/app/assets/javascripts/discourse/config/deprecation-workflow.js +++ b/app/assets/javascripts/discourse/config/deprecation-workflow.js @@ -10,7 +10,6 @@ globalThis.deprecationWorkflow.config = { { handler: "silence", matchId: "route-render-template" }, { handler: "silence", matchId: "routing.transition-methods" }, { handler: "silence", matchId: "route-disconnect-outlet" }, - { handler: "silence", matchId: "setting-on-hash" }, { handler: "silence", matchId: "this-property-fallback" }, { handler: "silence", matchId: "ember.globals-resolver" }, { handler: "silence", matchId: "globals-resolver" }, diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit.js b/app/assets/javascripts/select-kit/addon/components/select-kit.js index 95f8d8cd55d..71df384ac26 100644 --- a/app/assets/javascripts/select-kit/addon/components/select-kit.js +++ b/app/assets/javascripts/select-kit/addon/components/select-kit.js @@ -215,6 +215,7 @@ export default Component.extend( didReceiveAttrs() { this._super(...arguments); + const deprecatedOptions = this._resolveDeprecatedOptions(); const mergedOptions = Object.assign({}, ...this.selectKitOptions); Object.keys(mergedOptions).forEach((key) => { if (isPresent(this.options[key])) { @@ -222,6 +223,11 @@ export default Component.extend( return; } + if (isPresent(deprecatedOptions[`options.${key}`])) { + this.selectKit.options.set(key, deprecatedOptions[`options.${key}`]); + return; + } + const value = mergedOptions[key]; if ( @@ -1055,7 +1061,7 @@ export default Component.extend( handleDeprecations() { this._deprecateValueAttribute(); this._deprecateMutations(); - this._deprecateOptions(); + this._handleDeprecatdArgs(); }, _computePlacementStrategy() { @@ -1116,11 +1122,8 @@ export default Component.extend( } }, - _deprecateOptions() { + _resolveDeprecatedOptions() { const migrations = { - headerIcon: "icon", - onExpand: "onOpen", - onCollapse: "onClose", allowAny: "options.allowAny", allowCreate: "options.allowAny", filterable: "options.filterable", @@ -1141,6 +1144,29 @@ export default Component.extend( castInteger: "options.castInteger", }; + const resolvedDeprecations = {}; + + Object.keys(migrations).forEach((from) => { + const to = migrations[from]; + if (this.get(from) && !this.get(to)) { + this._deprecated( + `The \`${from}\` attribute is deprecated. Use \`${to}\` instead` + ); + + resolvedDeprecations[(to, this.get(from))]; + } + }); + + return resolvedDeprecations; + }, + + _handleDeprecatdArgs() { + const migrations = { + headerIcon: "icon", + onExpand: "onOpen", + onCollapse: "onClose", + }; + Object.keys(migrations).forEach((from) => { const to = migrations[from]; if (this.get(from) && !this.get(to)) {