From 01f52dc5c5f386e7fc223cbd5936cb66216da20d Mon Sep 17 00:00:00 2001 From: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com> Date: Fri, 13 May 2022 12:43:37 -0500 Subject: [PATCH] DEV: Remove 'dasherize' string prototype extensions (#173) Context: https://deprecations.emberjs.com/v3.x/#toc_ember-string-prototype_extensions --- .../javascripts/discourse/components/param-input.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/assets/javascripts/discourse/components/param-input.js b/assets/javascripts/discourse/components/param-input.js index 56e3ecd..bc11b82 100644 --- a/assets/javascripts/discourse/components/param-input.js +++ b/assets/javascripts/discourse/components/param-input.js @@ -1,6 +1,7 @@ import I18n from "I18n"; import { default as computed } from "discourse-common/utils/decorators"; import Category from "discourse/models/category"; +import { dasherize } from "@ember/string"; const layoutMap = { int: "int", @@ -100,8 +101,8 @@ export default Ember.Component.extend({ case "post_id": return isPositiveInt || /\d+\/\d+(\?u=.*)?$/.test(value); case "category_id": - if (!isPositiveInt && value !== value.dasherize()) { - this.set("value", value.dasherize()); + if (!isPositiveInt && value !== dasherize(value)) { + this.set("value", dasherize(value)); } if (isPositiveInt) { @@ -112,12 +113,12 @@ export default Ember.Component.extend({ return false; } const result = Category.findBySlug( - match[2].dasherize(), - match[1].dasherize() + dasherize(match[2]), + dasherize(match[1]) ); return !!result; } else { - return !!Category.findBySlug(value.dasherize()); + return !!Category.findBySlug(dasherize(value)); } case "group_id": const groups = this.site.get("groups");