Removal of Ember string prototype extensions

Problem is @ember/string is deprecated it appears after Ember 4.x? I can’t see this package in Ember 5.x … so this would just be a bandaid until Discourse rapidly moves into 5.x (which David alluded to here: Upgrading Discourse to Ember 4 - #14 by david)

@David what’s the right call here - use native Javascript (like I have)?

Thanks for the report - we weren’t expecting the JQuery change to affect string prototype extensions, so we’re digging into that :eyes:

As I understand it, it’s just the prototype extensions that are deprecated. So doing something like "mystring".capitalize() will not be allowed.

But you’ll still be able to do stuff like this:

import  { capitalize } from "@ember/string";

capitalize("mystring");

So, that’s what I’d recommend you do in the topic-list-previews component :ok_hand:

(more before/after examples here)

4 Likes

No worries but was surprise to me too :sweat_smile:

2 Likes

I had a look through all-the-themes and all-the-plugins, and there are just a couple of public plugins which need fixing up. I made PRs here: (cc @merefield @angus)

Godfrey did some digging for us into why the JQuery commit triggered this, and his findings are in this PR. So, it’s technically possible for us to restore this functionality, but it involves applying a patch to an upstream dependency which is not ideal.

Given the complexity, and that we’d be removing them in a few months anyway, I think it makes sense to just double-down on the removal now. I’ve formalised that in this PR:

Let us know if you have any questions/concerns

4 Likes

Thanks David. I agree with strategy. Kind of you to provide PRs. :pray:

5 Likes