Ebsy/discourse-nationalflags

Plugin is incompatible with Ember 5 and thus with upcoming new Discourse release

Closed this issue · 7 comments

After an update to Discourse 3.2.0.beta4, I see a banner warning

[Admin Notice] One of your themes or plugins needs updating for compatibility with upcoming Discourse core changes (more info).

In the console logs, I see

Usage of the Ember Global is deprecated. You should import the Ember module or the specific API instead. [deprecation id: ember-global] See https://deprecations.emberjs.com/v3.x/#toc_ember-global for more details.

More information is available here:

https://meta.discourse.org/t/preparing-for-discourses-upgrade-to-ember-5/287211?u=mcdanlj

I note the import is currently even included, but commented out. Is it as simple as this?

diff --git a/assets/javascripts/discourse/initializers/nationalflags.js.es6 b/assets/javascripts/discourse/initializers/nationalflags.js.es6
index 262a6fe..584673c 100755
--- a/assets/javascripts/discourse/initializers/nationalflags.js.es6
+++ b/assets/javascripts/discourse/initializers/nationalflags.js.es6
@@ -2,7 +2,7 @@ import {h} from 'virtual-dom';
 import {withPluginApi} from 'discourse/lib/plugin-api';
 import {ajax} from 'discourse/lib/ajax';
 
-// import Ember from 'ember';
+import Ember from 'ember';
 
 function initializeNationalFlags(api, siteSettings) {
   const nationalflagsEnabled = siteSettings.nationalflag_enabled;
Ebsy commented

Thanks for the heads up! @merefield Do you think you'll have a chance to look at this?

Sure I've submitted a PR #27 and will merge it straightaway as this appears completely broken 👍

I have just ugpraded our staging instance to Discourse 3.2 and hit issues with this plugin and, I think, the Ember 5 changes:

user-nationalflags-preferences.js:10 Uncaught (in promise) ReferenceError: Ember is not defined
    at s.callback (user-nationalflags-preferences.js:10:1)
    at s.exports (loader.js:106:1)
    at requireModule (loader.js:27:1)
    at d.get (index.js:25:12)
    at p._extractDefaultExport (index.js:468:39)
    at p.resolveOther (index.js:162:32)
    at p.resolve (index.js:190:23)
    at index.js:742:1
    at f.resolve (index.js:523:1)
    at f.resolve (index.js:525:1)
    at u.resolveRegistration (registry_proxy.js:16:1)
    at component-templates.js:44:31
    at Object.eachThemePluginTemplate (component-templates.js:95:11)
    at Object.initialize (component-templates.js:32:10)
    at index.js:145:1
    at e.each (dag-map.js:191:1)
    at e.walk (dag-map.js:120:1)
    at e.each (dag-map.js:66:1)
    at e.topsort (dag-map.js:72:1)
    at e._runInitializer (index.js:158:1)
    at e.runInstanceInitializers (index.js:143:1)
    at u._bootSync (instance.js:86:1)
    at e.didBecomeReady (index.js:602:1)
    at invoke (backburner.js.js:280:1)
    at h.flush (backburner.js.js:197:1)
    at p.flush (backburner.js.js:358:1)
    at B._end (backburner.js.js:798:1)
    at B._boundAutorunEnd (backburner.js.js:523:1)

@merefield Might need some more tweaks?

@mentalstring looks like you aren't running latest code. That was resolved in my PR (amongst other things)

Also please respect this is not my repo and I'm not an unlimited free resource. 😜

I honestly apologize — didn't mean to abuse of your time and good will. It's my bad as I missed that I was using my own fork to address the missing PLUGIN_ID issue. Can confirm that the latest version of the plugin is working with Discourse 3.2. Again, my apologies.

Glad you got it sorted 👍