DEV: Remove 'capitalize' string prototype extensions (#172)

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

View File

@ -4,6 +4,7 @@ import { ajax } from "discourse/lib/ajax";
import getURL from "discourse-common/lib/get-url"; import getURL from "discourse-common/lib/get-url";
import Badge from "discourse/models/badge"; import Badge from "discourse/models/badge";
import { default as computed } from "discourse-common/utils/decorators"; import { default as computed } from "discourse-common/utils/decorators";
import { capitalize } from "@ember/string";
function randomIdShort() { function randomIdShort() {
return "xxxxxxxx".replace(/[xy]/g, () => { return "xxxxxxxx".replace(/[xy]/g, () => {
@ -157,7 +158,7 @@ const QueryResultComponent = Ember.Component.extend({
const relationName = colRender[0]; const relationName = colRender[0];
if (relationName) { if (relationName) {
const lookupFunc = this[`lookup${relationName.capitalize()}`]; const lookupFunc = this[`lookup${capitalize(relationName)}`];
const labelSelector = labelSelectors[relationName]; const labelSelector = labelSelectors[relationName];
if (lookupFunc && labelSelector) { if (lookupFunc && labelSelector) {

View File

@ -3,6 +3,7 @@ import { categoryLinkHTML } from "discourse/helpers/category-link";
import { autoUpdatingRelativeAge } from "discourse/lib/formatter"; import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
import { convertIconClass, iconHTML } from "discourse-common/lib/icon-library"; import { convertIconClass, iconHTML } from "discourse-common/lib/icon-library";
import getURL from "discourse-common/lib/get-url"; import getURL from "discourse-common/lib/get-url";
import { capitalize } from "@ember/string";
function icon_or_image_replacement(str, ctx) { function icon_or_image_replacement(str, ctx) {
str = Ember.get(ctx.contexts[0], str); str = Ember.get(ctx.contexts[0], str);
@ -79,7 +80,7 @@ const QueryRowContentComponent = Ember.Component.extend({
return esc(row[idx]); return esc(row[idx]);
} }
const lookupFunc = parentView[`lookup${t.name.capitalize()}`]; const lookupFunc = parentView[`lookup${capitalize(t.name)}`];
if (lookupFunc) { if (lookupFunc) {
ctx[t.name] = lookupFunc.call(parentView, id); ctx[t.name] = lookupFunc.call(parentView, id);
} }