nodebb-plugin-shoutbox
Advanced tools
Comparing version 0.0.8 to 0.1.0
528
library.js
@@ -1,135 +0,59 @@ | ||
var async = require('async'), | ||
fs = require('fs'), | ||
var fs = require('fs'), | ||
path = require('path'), | ||
S = require('string'), | ||
User = module.parent.require('./user'), | ||
Meta = module.parent.require('./meta'), | ||
Plugins = module.parent.parent.require('./plugins'), | ||
db = module.parent.require('./database'), | ||
templates = module.parent.require('../public/src/templates'), | ||
SocketIndex = module.parent.require('./socket.io/index'), | ||
ModulesSockets = module.parent.require('./socket.io/modules'); | ||
var constants = Object.freeze({ | ||
'name': "Shoutbox", | ||
'icon': 'fa-bullhorn', | ||
'setting_prefix': 'shoutbox:', | ||
'global': { | ||
'route': '/shoutbox' | ||
}, | ||
'admin': { | ||
'route': '/plugins/shoutbox' | ||
}, | ||
'config_keys': ['headerlink','pageposition','shoutlimit'], | ||
'config_defaults': { | ||
'headerlink': '0', | ||
'pageposition': 'top', | ||
'shoutlimit': 25 | ||
}, | ||
'setting_keys': ['sound', 'notification'], | ||
'setting_defaults': { | ||
'sound': true, | ||
'notification': true | ||
} | ||
}); | ||
NodeBB = require('./lib/nodebb'), | ||
Config = require('./lib/config'), | ||
Sockets = require('./lib/sockets'), | ||
ModulesSockets = NodeBB.ModulesSockets, | ||
User = NodeBB.User, | ||
db = NodeBB.db, | ||
app; | ||
var Shoutbox = {}; | ||
Shoutbox.config = { | ||
"get": function(key) { | ||
if (constants.config_keys.indexOf(key) !== -1) { | ||
return Meta.config[constants.setting_prefix + key] || constants.config_defaults[key]; | ||
Shoutbox.init = { | ||
load: function(expressApp, middleware, controllers) { | ||
app = expressApp; | ||
function renderGlobal(req, res, next) { | ||
Config.api(function(data) { | ||
res.render('shoutbox', data); | ||
}); | ||
} | ||
}, | ||
"api": function(callback) { | ||
//Seriously can't think of a better name atm | ||
callback({}); | ||
} | ||
}; | ||
function renderAdmin(req, res, next) { | ||
Config.api(function(data) { | ||
res.render('shoutbox/admin', data); | ||
}); | ||
} | ||
app.get('/shoutbox', middleware.buildHeader, renderGlobal); | ||
app.get('/api/shoutbox', renderGlobal); | ||
Shoutbox.init = { | ||
"load": function() { | ||
ModulesSockets.shoutbox = Shoutbox.sockets; | ||
app.get('/admin/shoutbox', middleware.admin.buildHeader, renderAdmin); | ||
app.get('/api/admin/shoutbox', renderAdmin); | ||
ModulesSockets.shoutbox = Sockets; | ||
}, | ||
"global": { | ||
"addNavigation": function(custom_header, callback) { | ||
if (Shoutbox.config.get('headerlink') === '1') { | ||
global: { | ||
addNavigation: function(custom_header, callback) { | ||
if (Config.get('headerlink') === '1') { | ||
custom_header.navigation.push({ | ||
"class": "", | ||
"iconClass": "fa fa-fw " + constants.icon, | ||
"route": constants.global.route, | ||
"text": constants.name | ||
class: '', | ||
iconClass: 'fa fa-fw ' + Config.plugin.icon, | ||
route: Config.plugin.route, | ||
text: Config.plugin.name | ||
}); | ||
} | ||
return custom_header; | ||
}, | ||
"addRoute": function(custom_routes, callback) { | ||
fs.readFile(path.resolve(__dirname, './partials/shoutbox.tpl'), function (err, partial) { | ||
custom_routes.routes.push({ | ||
route: constants.global.route, | ||
method: "get", | ||
options: function(req, res, callback) { | ||
callback({ | ||
req: req, | ||
res: res, | ||
content: '<script> \ | ||
ajaxify.initialLoad = true; \ | ||
templates.ready(function(){ajaxify.go("shoutbox", null, true);}); \ | ||
</script>' | ||
}); | ||
} | ||
}); | ||
custom_routes.api.push({ | ||
route: constants.global.route, | ||
method: "get", | ||
callback: function(req, res, callback) { | ||
Shoutbox.config.api(callback); | ||
} | ||
}); | ||
custom_routes.templates.push({ | ||
"template": "shoutbox.tpl", | ||
"content": partial | ||
}); | ||
Shoutbox.widget.template = partial.toString(); | ||
callback(null, custom_routes); | ||
}); | ||
}, | ||
"addScripts": function(scripts, callback) { | ||
return scripts.concat([ | ||
'plugins/nodebb-plugin-shoutbox/public/js/main.js' | ||
]); | ||
callback(null, custom_header); | ||
} | ||
}, | ||
"admin": { | ||
"addNavigation": function(custom_header, callback) { | ||
admin: { | ||
addNavigation: function(custom_header, callback) { | ||
custom_header.plugins.push({ | ||
"route": constants.admin.route, | ||
"icon": constants.icon, | ||
"name": constants.name | ||
route: Config.plugin.route, | ||
icon: Config.plugin.icon, | ||
name: Config.plugin.name | ||
}); | ||
return custom_header; | ||
}, | ||
"addRoute": function(custom_routes, callback) { | ||
fs.readFile(path.join(__dirname, './partials/admin.tpl'), function(err, tpl) { | ||
custom_routes.routes.push({ | ||
route: constants.admin.route, | ||
method: "get", | ||
options: function(req, res, callback) { | ||
callback({ | ||
req: req, | ||
res: res, | ||
route: constants.admin.route, | ||
name: constants.name, | ||
content: tpl | ||
}); | ||
} | ||
}); | ||
callback(null, custom_routes); | ||
}); | ||
callback(null, custom_header); | ||
} | ||
@@ -140,355 +64,49 @@ } | ||
Shoutbox.widget = { | ||
"template": '', | ||
"define": function(widgets, callback) { | ||
define: function(widgets, callback) { | ||
widgets.push({ | ||
widget: "shoutbox", | ||
name: "Shoutbox", | ||
description: "Shoutbox widget.", | ||
content: "" | ||
name: Config.plugin.name, | ||
widget: Config.plugin.id, | ||
description: Config.plugin.description, | ||
content: '' | ||
}); | ||
callback(null, widgets); | ||
}, | ||
"render": function(widget, callback) { | ||
//We don't do anything fancy for now | ||
//This is because we have to maintain compatible with /shoutbox | ||
var html = ''; | ||
if (widget.uid !== 0) { | ||
html = templates.prepare(Shoutbox.widget.template).parse({}); | ||
} | ||
render: function(widget, callback) { | ||
//Remove any container | ||
widget.data.container = ''; | ||
callback(null, html); | ||
} | ||
} | ||
Shoutbox.sockets = { | ||
"get": function(socket, data, callback) { | ||
var start, end; | ||
if (data && (data.start && data.end)) { | ||
start = parseInt(data.start, 10); | ||
end = parseInt(data.end, 10); | ||
} else { | ||
start = -(parseInt(Shoutbox.config.get('shoutlimit'), 10) - 1); | ||
end = -1; | ||
} | ||
if (socket.uid) { | ||
Shoutbox.backend.getShouts(start, end, function(err, messages) { | ||
if (err) | ||
return callback(null, []); | ||
callback(null, messages); | ||
}); | ||
} else { | ||
callback(null, []); | ||
} | ||
}, | ||
"send": function(socket, data, callback) { | ||
if (socket.uid === 0) { | ||
return; | ||
} | ||
var msg = S(data.message).stripTags().s; | ||
User.getMultipleUserFields([socket.uid], ['username', 'picture', 'userslug'], function(err, userData) { | ||
if(err) { | ||
return; | ||
} | ||
userData = userData[0]; | ||
userData.uid = socket.uid; | ||
Shoutbox.backend.parse(msg, userData, true, function(err, parsed) { | ||
Shoutbox.backend.addShout(socket.uid, msg, function(err, message) { | ||
SocketIndex.server.sockets.in('global').emit('event:shoutbox.receive', { | ||
fromuid: message.fromuid, | ||
username: userData.username, | ||
content: parsed, | ||
sid: message.sid, | ||
timestamp: message.timestamp | ||
}); | ||
if (widget.uid !== 0) { | ||
//Currently doing this on the server -- still debating what's better | ||
Config.settings.get({ uid: widget.uid, settings: {} }, function(err, result) { | ||
Config.api(function(data) { | ||
data.hiddenStyle = ''; | ||
if (result.settings[Config.prefix + 'hide'] == 1) { | ||
data.hiddenStyle = 'display: none;'; | ||
} | ||
app.render('shoutbox', data, callback); | ||
}); | ||
}); | ||
}); | ||
}, | ||
"remove": function(socket, data, callback) { | ||
if (typeof(data.sid) === 'string') { | ||
Shoutbox.backend.removeShout(data.sid, socket.uid, function(err, result) { | ||
if (result === true) { | ||
SocketIndex.server.sockets.in('global').emit('event:shoutbox.delete', { | ||
'id': '#shoutbox-shout-' + data.sid | ||
}); | ||
} | ||
callback(err, result); | ||
}); | ||
// Client or server? | ||
// Config.api(function(data) { | ||
// app.render('shoutbox', data, callback); | ||
// }); | ||
} | ||
}, | ||
"edit": function(socket, data, callback) { | ||
if (typeof(data.sid) === 'string' && typeof(data.user) === 'string') { | ||
var msg = S(data.edited).stripTags().s; | ||
Shoutbox.backend.editShout(data.sid, msg, socket.uid, data.user, function(err, result) { | ||
if (result !== false) { | ||
SocketIndex.server.sockets.in('global').emit('event:shoutbox.edit', { | ||
'id': '#shoutbox-shout-' + data.sid, | ||
'content': result | ||
}); | ||
result = true; | ||
} | ||
callback(err, result); | ||
}); | ||
} | ||
}, | ||
"saveSetting": function(socket, data, callback) { | ||
if (!data.key || !socket.uid) { | ||
return callback(null, false); | ||
} | ||
var key = constants.setting_prefix + data.key; | ||
User.setUserField(socket.uid, key, data.value, callback); | ||
}, | ||
"removeAll": function(socket, data, callback) { | ||
if (data !== null && data !== undefined) { | ||
if (typeof(data.which) === "string") { | ||
if (data.which === 'deleted') { | ||
return Shoutbox.backend.pruneDeleted(socket.uid, callback); | ||
} else if (data.which ==='all') { | ||
return Shoutbox.backend.removeAll(socket.uid, callback); | ||
} | ||
} | ||
} | ||
return callback(null, false); | ||
}, | ||
"getUsers": function(socket, data, callback){ | ||
var users = Object.keys(SocketIndex.getConnectedClients()); | ||
User.getMultipleUserFields(users, ['username'], function(err, usersData) { | ||
if(err) { | ||
return callback(null, []); | ||
} | ||
return callback(null, usersData); | ||
}); | ||
}, | ||
"getConfig": function(socket, data, callback) { | ||
User.getUserFields(socket.uid, constants.setting_keys.map(function(e) { | ||
return constants.setting_prefix + e; | ||
}), function(err, result) { | ||
callback(null, { | ||
'maxShouts': parseInt(Shoutbox.config.get('shoutlimit'), 10), | ||
'pagePosition': Shoutbox.config.get('pageposition'), | ||
'settings': result | ||
}); | ||
}); | ||
}, | ||
"getOriginalShout": function(socket, data, callback) { | ||
if (data.sid && data.sid.length > 0) { | ||
Shoutbox.backend.getShout(data.sid, function(err, shout) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
return callback(null, shout.content); | ||
}); | ||
} | ||
} | ||
} | ||
Shoutbox.backend = { | ||
"addShout": function(fromuid, content, callback) { | ||
db.incrObjectField('global', 'nextSid', function(err, sid) { | ||
if (err) { | ||
return callback(err, null); | ||
} | ||
var shout = { | ||
content: content, | ||
timestamp: Date.now(), | ||
fromuid: fromuid, | ||
deleted: '0' | ||
}; | ||
db.setObject('shout:' + sid, shout); | ||
db.listAppend('shouts', sid); | ||
Shoutbox.backend.updateShoutTime(fromuid); | ||
shout.sid = sid; | ||
callback(null, shout); | ||
}); | ||
}, | ||
"getShout": function(sid, callback) { | ||
db.getObject('shout:' + sid, function(err, shout) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
return callback(null, shout); | ||
}); | ||
}, | ||
"getShouts": function(start, end, callback) { | ||
db.getListRange('shouts', start, end, function(err, sids) { | ||
if (err) { | ||
return callback(err, null); | ||
} | ||
if (!sids || !sids.length) { | ||
return callback(null, []); | ||
} | ||
function getShout(sid, next) { | ||
db.getObject('shout:' + sid, function(err, message) { | ||
if (err) { | ||
return next(err); | ||
} | ||
if (message.deleted === '1') { | ||
return next(null); | ||
} | ||
User.getMultipleUserFields([message.fromuid], ['username', 'picture', 'userslug'], function(err, userData) { | ||
userData = userData[0]; | ||
userData.uid = message.fromuid; | ||
Shoutbox.backend.parse(message.content, userData, false, function(err, parsed) { | ||
message.content = parsed; | ||
message.sid = sid; | ||
next(null, message); | ||
}); | ||
}); | ||
}); | ||
} | ||
async.map(sids, getShout, callback); | ||
}); | ||
}, | ||
"parse": function(message, userData, isNew, callback) { | ||
Plugins.fireHook('filter:post.parse', message, function(err, parsed) { | ||
User.isAdministrator(userData.uid, function(err, isAdmin) { | ||
var username, | ||
picture, | ||
userclass = "shoutbox-user"; | ||
if (isAdmin) { | ||
userclass += " shoutbox-user-admin"; | ||
} | ||
username = '<a href="/user/' + userData.userslug + '" ' + | ||
'class="' + userclass + '">' + userData.username + '</a>: '; | ||
picture = '<img class="shoutbox-user-image" src="' + userData.picture + '">'; | ||
var shoutData = { | ||
message: message, | ||
parsed: parsed, | ||
fromuid: userData.uid, | ||
myuid: userData.uid, | ||
toUserData: userData, | ||
myUserData: userData, | ||
isNew: isNew, | ||
parsedMessage: picture + username + parsed | ||
}; | ||
Plugins.fireHook('filter:messaging.parse', shoutData, function(err, messageData) { | ||
callback(null, messageData.parsedMessage); | ||
}); | ||
Shoutbox.settings = { | ||
addUserSettings: function(settings, callback) { | ||
app.render('shoutbox/user/settings', function(err, html) { | ||
settings.push({ | ||
title: Config.plugin.name, | ||
content: html | ||
}); | ||
callback(null, settings); | ||
}); | ||
}, | ||
"removeShout": function(sid, uid, callback) { | ||
User.isAdministrator(uid, function(err, isAdmin) { | ||
db.getObjectField('shout:' + sid, 'fromuid', function(err, fromuid) { | ||
if (err) { | ||
return callback("Unknown error", false); | ||
} | ||
if (fromuid === uid || isAdmin) { | ||
db.setObjectField('shout:' + sid, 'deleted', '1', function (err, result) { | ||
if (err) { | ||
return callback("Unknown error", false); | ||
} | ||
return callback(null, true); | ||
}); | ||
} else { | ||
return callback("Shout does not belong to you", false); | ||
} | ||
}); | ||
}); | ||
}, | ||
"editShout": function(sid, msg, uid, username, callback) { | ||
User.isAdministrator(uid, function(err, isAdmin) { | ||
db.getObjectField('shout:' + sid, 'fromuid', function(err, fromuid) { | ||
if (err) { | ||
return callback("Unknown error", false); | ||
} | ||
if (fromuid === uid || isAdmin) { | ||
db.setObjectField('shout:' + sid, 'content', msg, function (err, result) { | ||
if (err) { | ||
return callback("Unknown error", false); | ||
} | ||
User.getMultipleUserFields([fromuid], ['username', 'picture', 'userslug'], function(err, userData) { | ||
userData = userData[0]; | ||
userData.uid = fromuid; | ||
Shoutbox.backend.parse(msg, userData, false, function(err, result) { | ||
return callback(null, result); | ||
}); | ||
}); | ||
}); | ||
} else { | ||
return callback("Shout does not belong to you", false); | ||
} | ||
}); | ||
}); | ||
}, | ||
"pruneDeleted": function(uid, callback) { | ||
User.isAdministrator(uid, function(err, isAdmin) { | ||
if (isAdmin === true) { | ||
db.getListRange('shouts', 0, -1, function(err, sids) { | ||
if (err || !sids || !sids.length) { | ||
return callback(err, false); | ||
} | ||
function deleteShout(sid, next) { | ||
db.getObjectField('shout:' + sid, 'deleted', function(err, isDeleted) { | ||
if (isDeleted === '1') { | ||
db.delete('shout:' + sid); | ||
db.listRemoveAll('shouts', sid); | ||
next() | ||
} | ||
next(null); | ||
}); | ||
} | ||
async.map(sids, deleteShout, function(err) { | ||
if (err) { | ||
return callback(err, false); | ||
} | ||
return callback(null, true); | ||
}); | ||
}); | ||
} else { | ||
return callback("Not allowed", false); | ||
} | ||
}); | ||
}, | ||
"removeAll": function(uid, callback) { | ||
User.isAdministrator(uid, function(err, isAdmin) { | ||
if (isAdmin === true) { | ||
db.getListRange('shouts', 0, -1, function(err, sids) { | ||
if (err || !sids || !sids.length) { | ||
return callback(err, false); | ||
} | ||
function deleteShout(sid, next) { | ||
db.delete('shout:' + sid); | ||
db.listRemoveAll('shouts', sid); | ||
next(); | ||
} | ||
async.eachSeries(sids, deleteShout, function(err) { | ||
db.setObjectField('global', 'nextSid', 0, function(err, result) { | ||
if (err) { | ||
return callback(err, null); | ||
} | ||
return callback(null, true); | ||
}); | ||
}); | ||
}); | ||
} else { | ||
return callback("Not allowed", false); | ||
} | ||
}); | ||
getUserSettings: function(data, callback) { | ||
Config.settings.get(data, callback); | ||
}, | ||
"updateShoutTime": function(uid, callback) { | ||
db.sortedSetAdd('uid:' + uid + ':shouts', Date.now(), 0, function(err) { | ||
if (callback) { | ||
callback(err); | ||
} | ||
}); | ||
saveUserSettings: function(data) { | ||
Config.settings.save(data); | ||
} | ||
@@ -495,0 +113,0 @@ } |
{ | ||
"name": "nodebb-plugin-shoutbox", | ||
"version": "0.0.8", | ||
"version": "0.1.0", | ||
"description": "NodeBB Shoutbox Plugin", | ||
@@ -11,3 +11,3 @@ "main": "library.js", | ||
"type": "git", | ||
"url": "https://github.com/MrWaffle/nodebb-plugin-shoutbox" | ||
"url": "https://github.com/Schamper/nodebb-plugin-shoutbox" | ||
}, | ||
@@ -19,6 +19,6 @@ "keywords": [ | ||
], | ||
"author": "Mr_Waffle <mrwafflewaffle@aim.com>", | ||
"author": "Schamper <mrwafflewaffle@aim.com>", | ||
"license": "BSD-2-Clause", | ||
"bugs": { | ||
"url": "https://github.com/MrWaffle/nodebb-plugin-shoutbox/issues" | ||
"url": "https://github.com/Schamper/nodebb-plugin-shoutbox/issues" | ||
}, | ||
@@ -28,4 +28,4 @@ "dependencies": { | ||
"path": "~0.4.9", | ||
"string": "~1.8.0" | ||
"string": "~1.8.0" | ||
} | ||
} |
@@ -5,13 +5,13 @@ { | ||
"description": "NodeBB Plugin Shoutbox", | ||
"url": "https://github.com/MrWaffle/nodebb-plugin-shoutbox", | ||
"url": "https://github.com/Schamper/nodebb-plugin-shoutbox", | ||
"library": "./library.js", | ||
"hooks": [ | ||
{ "hook": "filter:admin.header.build", "method": "init.admin.addNavigation", "callbacked": false }, | ||
{ "hook": "filter:admin.create_routes", "method": "init.admin.addRoute", "callbacked": true }, | ||
{ "hook": "filter:header.build", "method": "init.global.addNavigation", "callbacked": false }, | ||
{ "hook": "filter:server.create_routes", "method": "init.global.addRoute", "callbacked": true }, | ||
{ "hook": "filter:scripts.get", "method": "init.global.addScripts", "callbacked": false }, | ||
{ "hook": "filter:widgets.getWidgets", "method": "widget.define", "callbacked": true }, | ||
{ "hook": "filter:widget.render:shoutbox", "method": "widget.render", "callbacked": true }, | ||
{ "hook": "action:app.load", "method": "init.load", "callbacked": false } | ||
{ "hook": "action:app.load", "method": "init.load" }, | ||
{ "hook": "filter:admin.header.build", "method": "init.admin.addNavigation" }, | ||
{ "hook": "filter:header.build", "method": "init.global.addNavigation" }, | ||
{ "hook": "filter:user.settings", "method": "settings.addUserSettings" }, | ||
{ "hook": "filter:user.getSettings", "method": "settings.getUserSettings" }, | ||
{ "hook": "action:user.saveSettings", "method": "settings.saveUserSettings" }, | ||
{ "hook": "filter:widgets.getWidgets", "method": "widget.define" }, | ||
{ "hook": "filter:widget.render:shoutbox", "method": "widget.render" } | ||
], | ||
@@ -24,3 +24,7 @@ "staticDirs": { | ||
], | ||
"scripts": [ | ||
"public/js/loader.js" | ||
], | ||
"templates": "./templates", | ||
"minver": "0.4.0" | ||
} |
(function() { | ||
$(document).ready(function() { | ||
require(['forum/admin/settings'], function(Settings) { | ||
Settings.prepare(function() { | ||
prepareFeatures(); | ||
}); | ||
}); | ||
prepareButtons(); | ||
}); | ||
function prepareFeatures() { | ||
function updateSettings() { | ||
var features = {}; | ||
$('[data-feature]').each(function() { | ||
var feature = $(this).data('feature'); | ||
features[feature] = { | ||
feature: feature, | ||
enabled: $(this).find('.fa').hasClass('fa-check-circle') | ||
}; | ||
}); | ||
$('#features-settings').val(JSON.stringify(features)); | ||
} | ||
function on(feature) { | ||
var el = $('[data-feature="' + feature + '"]'); | ||
el.find('.fa').removeClass('fa-times-circle').addClass('fa-check-circle'); | ||
el.removeClass('disabled'); | ||
} | ||
function off(feature) { | ||
var el = $('[data-feature="' + feature + '"]'); | ||
el.find('.fa').removeClass('fa-check-circle').addClass('fa-times-circle'); | ||
el.addClass('disabled'); | ||
} | ||
function toggleFeature(el) { | ||
var feature = $(el).parents("[data-feature]").data('feature'); | ||
if ($(el).find('.fa').hasClass('fa-times-circle')) { | ||
on(feature); | ||
} else { | ||
off(feature); | ||
} | ||
updateSettings(); | ||
} | ||
$('.features').on('click', '.toggle-feature', function() { | ||
toggleFeature(this); | ||
}).on('dblclick', '.panel-heading', function() { | ||
toggleFeature(this); | ||
}).disableSelection(); | ||
$('.features-save').on('click', function(e) { | ||
$('#save').click(); | ||
e.preventDefault(); | ||
return false; | ||
}); | ||
var saved = JSON.parse($('#features-settings').val()); | ||
for (var feature in saved) { | ||
if (saved.hasOwnProperty(feature)) { | ||
if (!saved[feature].enabled) { | ||
off(feature); | ||
} | ||
} | ||
} | ||
updateSettings(); | ||
} | ||
function prepareButtons() { | ||
$('#shoutbox-remove-deleted-button').off('click').on('click', function(e) { | ||
@@ -7,7 +73,6 @@ bootbox.confirm('Are you sure you wish to remove all shouts marked as deleted from the database?', function(confirm) { | ||
socket.emit('modules.shoutbox.removeAll', {'which':'deleted'}, function(err, result) { | ||
console.log(err, result); | ||
if(err) { | ||
return app.alertError(err.message); | ||
} else { | ||
return app.alertSuccess("Successfully removed all shouts marked as deleted from the database"); | ||
return app.alertSuccess('Successfully removed all shouts marked as deleted from the database'); | ||
} | ||
@@ -23,7 +88,6 @@ }); | ||
socket.emit('modules.shoutbox.removeAll', {'which':'all'}, function(err, result) { | ||
console.log(err, result); | ||
if(err) { | ||
return app.alertError(err.message); | ||
} else { | ||
return app.alertSuccess("Successfully removed all shouts from the database"); | ||
return app.alertSuccess('Successfully removed all shouts from the database'); | ||
} | ||
@@ -34,3 +98,3 @@ }); | ||
}); | ||
}); | ||
} | ||
}()); |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
54569
26
1274
4
1