From d5e11a2c65060b8a7792a48b95bbeea3e4214a46 Mon Sep 17 00:00:00 2001 From: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com> Date: Fri, 13 May 2022 12:33:38 -0500 Subject: [PATCH] DEV: Remove 'capitalize' string prototype extensions (#172) Context: https://deprecations.emberjs.com/v3.x/#toc_ember-string-prototype_extensions --- assets/javascripts/discourse/components/query-result.js | 3 ++- assets/javascripts/discourse/components/query-row-content.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/javascripts/discourse/components/query-result.js b/assets/javascripts/discourse/components/query-result.js index 8e18381..bbc8746 100644 --- a/assets/javascripts/discourse/components/query-result.js +++ b/assets/javascripts/discourse/components/query-result.js @@ -4,6 +4,7 @@ import { ajax } from "discourse/lib/ajax"; import getURL from "discourse-common/lib/get-url"; import Badge from "discourse/models/badge"; import { default as computed } from "discourse-common/utils/decorators"; +import { capitalize } from "@ember/string"; function randomIdShort() { return "xxxxxxxx".replace(/[xy]/g, () => { @@ -157,7 +158,7 @@ const QueryResultComponent = Ember.Component.extend({ const relationName = colRender[0]; if (relationName) { - const lookupFunc = this[`lookup${relationName.capitalize()}`]; + const lookupFunc = this[`lookup${capitalize(relationName)}`]; const labelSelector = labelSelectors[relationName]; if (lookupFunc && labelSelector) { diff --git a/assets/javascripts/discourse/components/query-row-content.js b/assets/javascripts/discourse/components/query-row-content.js index df13dc6..b9937be 100644 --- a/assets/javascripts/discourse/components/query-row-content.js +++ b/assets/javascripts/discourse/components/query-row-content.js @@ -3,6 +3,7 @@ import { categoryLinkHTML } from "discourse/helpers/category-link"; import { autoUpdatingRelativeAge } from "discourse/lib/formatter"; import { convertIconClass, iconHTML } from "discourse-common/lib/icon-library"; import getURL from "discourse-common/lib/get-url"; +import { capitalize } from "@ember/string"; function icon_or_image_replacement(str, ctx) { str = Ember.get(ctx.contexts[0], str); @@ -79,7 +80,7 @@ const QueryRowContentComponent = Ember.Component.extend({ return esc(row[idx]); } - const lookupFunc = parentView[`lookup${t.name.capitalize()}`]; + const lookupFunc = parentView[`lookup${capitalize(t.name)}`]; if (lookupFunc) { ctx[t.name] = lookupFunc.call(parentView, id); }