lint: Replace use of underscore.js with plain ECMAScript

pull/4765/head
Richard Hansen 2021-02-09 16:54:25 -05:00 committed by John McLear
parent ab127289c4
commit 8919f63c98
1 changed files with 5 additions and 13 deletions

View File

@ -4,7 +4,6 @@ const minify = require('../../utils/Minify');
const plugins = require('../../../static/js/pluginfw/plugin_defs'); const plugins = require('../../../static/js/pluginfw/plugin_defs');
const CachingMiddleware = require('../../utils/caching_middleware'); const CachingMiddleware = require('../../utils/caching_middleware');
const Yajsml = require('etherpad-yajsml'); const Yajsml = require('etherpad-yajsml');
const _ = require('underscore');
exports.expressCreateServer = (hookName, args, cb) => { exports.expressCreateServer = (hookName, args, cb) => {
// Cache both minified and static. // Cache both minified and static.
@ -38,19 +37,12 @@ exports.expressCreateServer = (hookName, args, cb) => {
// not very static, but served here so that client can do // not very static, but served here so that client can do
// require("pluginfw/static/js/plugin-definitions.js"); // require("pluginfw/static/js/plugin-definitions.js");
args.app.get('/pluginfw/plugin-definitions.json', (req, res, next) => { args.app.get('/pluginfw/plugin-definitions.json', (req, res, next) => {
const clientParts = _(plugins.parts) const clientParts = plugins.parts.filter((part) => part.client_hooks != null);
.filter((part) => _(part).has('client_hooks'));
const clientPlugins = {}; const clientPlugins = {};
for (const name of new Set(clientParts.map((part) => part.plugin))) {
_(clientParts).chain() clientPlugins[name] = {...plugins.plugins[name]};
.map((part) => part.plugin) delete clientPlugins[name].package;
.uniq() }
.each((name) => {
clientPlugins[name] = _(plugins.plugins[name]).clone();
delete clientPlugins[name].package;
});
res.header('Content-Type', 'application/json; charset=utf-8'); res.header('Content-Type', 'application/json; charset=utf-8');
res.write(JSON.stringify({plugins: clientPlugins, parts: clientParts})); res.write(JSON.stringify({plugins: clientPlugins, parts: clientParts}));
res.end(); res.end();