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({
|
Discourse.instanceInitializer({
|
||||||
name: "_discourse_plugin_" + (++initCount),
|
name: "_discourse_plugin_" + (++initCount),
|
||||||
after: 'inject-objects',
|
after: 'inject-objects',
|
||||||
initialize: function() {
|
initialize() {
|
||||||
withPluginApi(cb.version, cb.code);
|
withPluginApi(cb.version, cb.code);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -361,6 +361,11 @@ function getPluginApi(version) {
|
||||||
if (!_pluginv01) {
|
if (!_pluginv01) {
|
||||||
_pluginv01 = new PluginApi(version, Discourse.__container__);
|
_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;
|
return _pluginv01;
|
||||||
} else {
|
} else {
|
||||||
console.warn(`Plugin API v${version} is not supported`);
|
console.warn(`Plugin API v${version} is not supported`);
|
||||||
|
|
Loading…
Reference in New Issue