FIX: Always return the latest API version requested
This commit is contained in:
parent
98eac4924c
commit
3786d3679c
|
@ -137,7 +137,7 @@ const Discourse = Ember.Application.extend({
|
|||
Discourse.instanceInitializer({
|
||||
name: "_discourse_plugin_" + (++initCount),
|
||||
after: 'inject-objects',
|
||||
initialize: function() {
|
||||
initialize() {
|
||||
withPluginApi(cb.version, cb.code);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -361,6 +361,11 @@ function getPluginApi(version) {
|
|||
if (!_pluginv01) {
|
||||
_pluginv01 = new PluginApi(version, Discourse.__container__);
|
||||
}
|
||||
|
||||
// We are recycling the compatible object, but let's update to the higher version
|
||||
if (_pluginv01.version < version) {
|
||||
_pluginv01.version = version;
|
||||
}
|
||||
return _pluginv01;
|
||||
} else {
|
||||
console.warn(`Plugin API v${version} is not supported`);
|
||||
|
|
Loading…
Reference in New Issue