DEV: Remove 'dasherize' string prototype extensions (#173)
Context: https://deprecations.emberjs.com/v3.x/#toc_ember-string-prototype_extensions
This commit is contained in:
parent
d5e11a2c65
commit
01f52dc5c5
|
@ -1,6 +1,7 @@
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import { default as computed } from "discourse-common/utils/decorators";
|
import { default as computed } from "discourse-common/utils/decorators";
|
||||||
import Category from "discourse/models/category";
|
import Category from "discourse/models/category";
|
||||||
|
import { dasherize } from "@ember/string";
|
||||||
|
|
||||||
const layoutMap = {
|
const layoutMap = {
|
||||||
int: "int",
|
int: "int",
|
||||||
|
@ -100,8 +101,8 @@ export default Ember.Component.extend({
|
||||||
case "post_id":
|
case "post_id":
|
||||||
return isPositiveInt || /\d+\/\d+(\?u=.*)?$/.test(value);
|
return isPositiveInt || /\d+\/\d+(\?u=.*)?$/.test(value);
|
||||||
case "category_id":
|
case "category_id":
|
||||||
if (!isPositiveInt && value !== value.dasherize()) {
|
if (!isPositiveInt && value !== dasherize(value)) {
|
||||||
this.set("value", value.dasherize());
|
this.set("value", dasherize(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPositiveInt) {
|
if (isPositiveInt) {
|
||||||
|
@ -112,12 +113,12 @@ export default Ember.Component.extend({
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const result = Category.findBySlug(
|
const result = Category.findBySlug(
|
||||||
match[2].dasherize(),
|
dasherize(match[2]),
|
||||||
match[1].dasherize()
|
dasherize(match[1])
|
||||||
);
|
);
|
||||||
return !!result;
|
return !!result;
|
||||||
} else {
|
} else {
|
||||||
return !!Category.findBySlug(value.dasherize());
|
return !!Category.findBySlug(dasherize(value));
|
||||||
}
|
}
|
||||||
case "group_id":
|
case "group_id":
|
||||||
const groups = this.site.get("groups");
|
const groups = this.site.get("groups");
|
||||||
|
|
Loading…
Reference in New Issue