Fix a myriad of problems with the ACP/Plugins page

- Fixed #3350
- Fixed issue where the normalised API return would have the wrong id for all plugins
- Fixed issue where uninstalling a locally installed plugin via ACP would cause NodeBB to crash
- Simplified ACP/Plugins client-side code to simply refresh the page after installing or uninstalling a plugin.
This commit is contained in:
Julian Lam
2015-08-06 12:41:16 -04:00
parent f53fb19468
commit e60194292f
2 changed files with 6 additions and 17 deletions

View File

@@ -170,9 +170,13 @@ var fs = require('fs'),
require('request')(url, {
json: true
}, function(err, res, body) {
if (res.statusCode === 404 || !body.payload) {
return callback(err, {});
}
Plugins.normalise([body.payload], function(err, normalised) {
normalised = normalised.filter(function(plugin) {
return plugin.id = id;
return plugin.id === id;
});
return callback(err, !err ? normalised[0] : undefined);
});