DEV: Remove 'dasherize' string prototype extensions (#173)

Context: https://deprecations.emberjs.com/v3.x/#toc_ember-string-prototype_extensions
This commit is contained in:
Isaac Janzen 2022-05-13 12:43:37 -05:00 committed by GitHub
parent d5e11a2c65
commit 01f52dc5c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -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");