diff --git a/.eslintrc b/.eslintrc index de634c9243..10219b1d01 100644 --- a/.eslintrc +++ b/.eslintrc @@ -97,7 +97,7 @@ "no-var": "off", "no-shadow": "off", "prefer-template": "off", - "padded-blocks": "off", + // "padded-blocks": "off", // "eol-last": "off", // "lines-around-directive": "off", // "strict": "off", diff --git a/loader.js b/loader.js index 9141ead0f8..5dcc382d47 100644 --- a/loader.js +++ b/loader.js @@ -48,7 +48,6 @@ Loader.displayStartupMessages = function (callback) { }; Loader.addWorkerEvents = function (worker) { - worker.on('exit', function (code, signal) { if (code !== 0) { if (Loader.timesStarted < numProcs * 3) { diff --git a/minifier.js b/minifier.js index b7a605d103..e57c30fb38 100644 --- a/minifier.js +++ b/minifier.js @@ -11,7 +11,6 @@ var Minifier = { /* Javascript */ Minifier.js.minify = function (scripts, minify, callback) { - scripts = scripts.filter(function (file) { return file && file.endsWith('.js'); }); diff --git a/public/src/admin/advanced/events.js b/public/src/admin/advanced/events.js index 92f660f707..2be2c44ee7 100644 --- a/public/src/admin/advanced/events.js +++ b/public/src/admin/advanced/events.js @@ -5,7 +5,6 @@ define('admin/advanced/events', function () { var Events = {}; Events.init = function () { - $('[data-action="clear"]').on('click', function () { socket.emit('admin.deleteAllEvents', function (err) { if (err) { @@ -14,7 +13,6 @@ define('admin/advanced/events', function () { $('.events-list').empty(); }); }); - }; return Events; diff --git a/public/src/admin/appearance/themes.js b/public/src/admin/appearance/themes.js index 95c3f896f0..68165268b2 100644 --- a/public/src/admin/appearance/themes.js +++ b/public/src/admin/appearance/themes.js @@ -72,7 +72,6 @@ define('admin/appearance/themes', ['translator'], function (translator) { if (!themes.length) { instListEl.append($('
  • ').addClass('no-themes').translateHtml('[[admin/appearance/themes:no-themes]]')); - } else { templates.parse('admin/partials/theme_list', { themes: themes, diff --git a/public/src/admin/extend/widgets.js b/public/src/admin/extend/widgets.js index d4356a1cb4..134efe3864 100644 --- a/public/src/admin/extend/widgets.js +++ b/public/src/admin/extend/widgets.js @@ -132,7 +132,6 @@ define('admin/extend/widgets', ['jqueryui'], function (jqueryui) { timeout: 2500, }); } - }); }); } diff --git a/public/src/admin/general/homepage.js b/public/src/admin/general/homepage.js index 3d36460e3c..17e28d8cbb 100644 --- a/public/src/admin/general/homepage.js +++ b/public/src/admin/general/homepage.js @@ -2,7 +2,6 @@ define('admin/general/homepage', ['admin/settings'], function (Settings) { - function toggleCustomRoute() { if ($('[data-field="homePageRoute"]').val()) { $('#homePageCustom').hide(); diff --git a/public/src/admin/manage/flags.js b/public/src/admin/manage/flags.js index 21c9d3d015..af44392a7d 100644 --- a/public/src/admin/manage/flags.js +++ b/public/src/admin/manage/flags.js @@ -7,7 +7,6 @@ define('admin/manage/flags', [ 'components', 'translator', ], function (autocomplete, Chart, components, translator) { - var Flags = {}; Flags.init = function () { diff --git a/public/src/admin/manage/group.js b/public/src/admin/manage/group.js index 19397dc9fd..89985f3ba5 100644 --- a/public/src/admin/manage/group.js +++ b/public/src/admin/manage/group.js @@ -32,7 +32,6 @@ define('admin/manage/group', [ }); groupDetailsSearch.on('keyup', function () { - if (searchDelay) { clearTimeout(searchDelay); } @@ -140,7 +139,6 @@ define('admin/manage/group', [ } userRow.slideUp().remove(); }); - }); break; default: @@ -186,7 +184,6 @@ define('admin/manage/group', [ }); return false; }); - }; return Groups; diff --git a/public/src/admin/manage/ip-blacklist.js b/public/src/admin/manage/ip-blacklist.js index 8e2bbeb007..5dd3e32fb1 100644 --- a/public/src/admin/manage/ip-blacklist.js +++ b/public/src/admin/manage/ip-blacklist.js @@ -2,7 +2,6 @@ define('admin/manage/ip-blacklist', ['translator'], function (translator) { - var Blacklist = {}; Blacklist.init = function () { diff --git a/public/src/admin/manage/registration.js b/public/src/admin/manage/registration.js index 2b4d430325..3107e6c19f 100644 --- a/public/src/admin/manage/registration.js +++ b/public/src/admin/manage/registration.js @@ -5,7 +5,6 @@ define('admin/manage/registration', function () { var Registration = {}; Registration.init = function () { - $('.users-list').on('click', '[data-action]', function (ev) { var parent = $(this).parents('[data-username]'); var action = $(this).attr('data-action'); diff --git a/public/src/admin/manage/users.js b/public/src/admin/manage/users.js index d5c0ec7ad9..75f2ce700a 100644 --- a/public/src/admin/manage/users.js +++ b/public/src/admin/manage/users.js @@ -360,7 +360,6 @@ define('admin/manage/users', ['translator'], function (translator) { handleUserCreate(); handleInvite(); - }; function handleInvite() { diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index af52223536..7ab91acdbc 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -81,7 +81,6 @@ $(document).ready(function () { $('#footer, #content').removeClass('hide').addClass('ajaxifying'); ajaxify.loadData(url, function (err, data) { - if (!err || (err && err.data && (parseInt(err.data.status, 10) !== 302 && parseInt(err.data.status, 10) !== 308))) { ajaxify.updateHistory(url, quiet); } @@ -158,7 +157,6 @@ $(document).ready(function () { app.alertError('[[global:please_log_in]]'); app.previousUrl = url; window.location.href = config.relative_path + '/login'; - } else if (status === 302 || status === 308) { if (data.responseJSON && data.responseJSON.external) { window.location.href = data.responseJSON.external; @@ -422,5 +420,4 @@ $(document).ready(function () { templates.cache[$(this).attr('data-template')] = $('
    ').html($(this).html()).text(); $(this).parent().remove(); }); - }); diff --git a/public/src/app.js b/public/src/app.js index 2a95ba29f7..37eb41b564 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -657,6 +657,5 @@ app.cacheBuster = null; }); }); }); - }; }()); diff --git a/public/src/client/account/edit.js b/public/src/client/account/edit.js index b805404cbc..f70e692f45 100644 --- a/public/src/client/account/edit.js +++ b/public/src/client/account/edit.js @@ -5,7 +5,6 @@ define('forum/account/edit', ['forum/account/header', 'translator', 'components' var AccountEdit = {}; AccountEdit.init = function () { - header.init(); $('#submitBtn').on('click', updateProfile); @@ -70,7 +69,6 @@ define('forum/account/edit', ['forum/account/header', 'translator', 'components' } function handleImageChange() { - $('#changePictureBtn').on('click', function () { socket.emit('user.getProfilePictures', {uid: ajaxify.data.uid}, function (err, pictures) { if (err) { diff --git a/public/src/client/account/profile.js b/public/src/client/account/profile.js index e703b23af5..9713b57122 100644 --- a/public/src/client/account/profile.js +++ b/public/src/client/account/profile.js @@ -70,7 +70,6 @@ define('forum/account/profile', [ } app.parseAndTranslate('account/profile', 'posts', {posts: posts}, function (html) { - $('[component="posts"]').append(html); html.find('.timeago').timeago(); diff --git a/public/src/client/category.js b/public/src/client/category.js index e61b0b5e53..af4f6dba8c 100644 --- a/public/src/client/category.js +++ b/public/src/client/category.js @@ -118,7 +118,6 @@ define('forum/category', [ $(window).on('action:ajaxify.contentLoaded', function (ev, data) { if (ajaxify.data.template.category && ajaxify.data.cid) { - var bookmarkIndex = localStorage.getItem('category:' + ajaxify.data.cid + ':bookmark'); var clickedIndex = localStorage.getItem('category:' + ajaxify.data.cid + ':bookmark:clicked'); diff --git a/public/src/client/category/tools.js b/public/src/client/category/tools.js index 36955d25ff..0f8c009e06 100644 --- a/public/src/client/category/tools.js +++ b/public/src/client/category/tools.js @@ -8,7 +8,6 @@ define('forum/category/tools', [ 'components', 'translator', ], function (move, topicSelect, components, translator) { - var CategoryTools = {}; CategoryTools.init = function (cid) { @@ -161,7 +160,6 @@ define('forum/category/tools', [ } function updateDropdownOptions() { - var tids = topicSelect.getSelectedTids(); var isAnyDeleted = isAny(isTopicDeleted, tids); var areAllDeleted = areAll(isTopicDeleted, tids); diff --git a/public/src/client/chats.js b/public/src/client/chats.js index 88fc720080..4879485993 100644 --- a/public/src/client/chats.js +++ b/public/src/client/chats.js @@ -60,7 +60,6 @@ define('forum/chats', [ Chats.addSendHandlers(ajaxify.data.roomId, $('.chat-input'), $('.expanded-chat button[data-action="send"]')); $('[data-action="pop-out"]').on('click', function () { - var text = components.get('chat/input').val(); var roomId = ajaxify.data.roomId; diff --git a/public/src/client/chats/messages.js b/public/src/client/chats/messages.js index e448554a8e..4c804643a7 100644 --- a/public/src/client/chats/messages.js +++ b/public/src/client/chats/messages.js @@ -2,7 +2,6 @@ define('forum/chats/messages', ['components', 'sounds', 'translator'], function (components, sounds, translator) { - var messages = {}; messages.sendMessage = function (roomId, inputEl) { @@ -57,7 +56,6 @@ define('forum/chats/messages', ['components', 'sounds', 'translator'], function }; messages.appendChatMessage = function (chatContentEl, data) { - var lastSpeaker = parseInt(chatContentEl.find('.chat-message').last().attr('data-uid'), 10); if (!Array.isArray(data)) { data.newSet = lastSpeaker !== data.fromuid; diff --git a/public/src/client/chats/recent.js b/public/src/client/chats/recent.js index 8224cda8c2..f52f95fbbf 100644 --- a/public/src/client/chats/recent.js +++ b/public/src/client/chats/recent.js @@ -2,7 +2,6 @@ define('forum/chats/recent', function () { - var recent = {}; recent.init = function () { diff --git a/public/src/client/chats/search.js b/public/src/client/chats/search.js index ab8b8d54fd..f9504e78a4 100644 --- a/public/src/client/chats/search.js +++ b/public/src/client/chats/search.js @@ -2,7 +2,6 @@ define('forum/chats/search', ['components'], function (components) { - var search = {}; search.init = function () { diff --git a/public/src/client/footer.js b/public/src/client/footer.js index b6b7d243c9..eb921f36c6 100644 --- a/public/src/client/footer.js +++ b/public/src/client/footer.js @@ -2,7 +2,6 @@ define('forum/footer', ['notifications', 'chat', 'components', 'translator'], function (Notifications, Chat, components, translator) { - Notifications.prepareDOM(); Chat.prepareDOM(); translator.prepareDOM(); diff --git a/public/src/client/groups/details.js b/public/src/client/groups/details.js index 87ef07b573..21549ec2a7 100644 --- a/public/src/client/groups/details.js +++ b/public/src/client/groups/details.js @@ -10,7 +10,6 @@ define('forum/groups/details', [ 'translator', 'vendor/colorpicker/colorpicker', ], function (memberList, iconSelect, components, coverPhoto, pictureCropper, translator) { - var Details = {}; var groupName; diff --git a/public/src/client/groups/memberlist.js b/public/src/client/groups/memberlist.js index 2b5cbb5648..6ab83ccbbc 100644 --- a/public/src/client/groups/memberlist.js +++ b/public/src/client/groups/memberlist.js @@ -2,7 +2,6 @@ define('forum/groups/memberlist', ['components', 'forum/infinitescroll'], function (components, infinitescroll) { - var MemberList = {}; var searchInterval; var groupName; diff --git a/public/src/client/infinitescroll.js b/public/src/client/infinitescroll.js index 24e7f6fc68..208448d8a5 100644 --- a/public/src/client/infinitescroll.js +++ b/public/src/client/infinitescroll.js @@ -2,7 +2,6 @@ define('forum/infinitescroll', function () { - var scroll = {}; var callback; var previousScrollTop = 0; diff --git a/public/src/client/recent.js b/public/src/client/recent.js index 511137adbb..4acb4905ba 100644 --- a/public/src/client/recent.js +++ b/public/src/client/recent.js @@ -146,7 +146,6 @@ define('forum/recent', ['forum/infinitescroll', 'components'], function (infinit }; Recent.onTopicsLoaded = function (templateName, topics, showSelect, callback) { - topics = topics.filter(function (topic) { return !components.get('category/topic', 'tid', topic.tid).length; }); diff --git a/public/src/client/topic.js b/public/src/client/topic.js index 106a8e99f1..9088830554 100644 --- a/public/src/client/topic.js +++ b/public/src/client/topic.js @@ -243,13 +243,11 @@ define('forum/topic', [ var newUrl = 'topic/' + ajaxify.data.slug + (index > 1 ? ('/' + index) : ''); if (newUrl !== currentUrl) { - if (Topic.replaceURLTimeout) { clearTimeout(Topic.replaceURLTimeout); } Topic.replaceURLTimeout = setTimeout(function () { - if (index >= elementCount && app.user.uid) { socket.emit('topics.markAsRead', [ajaxify.data.tid]); } @@ -296,7 +294,6 @@ define('forum/topic', [ if (!currentBookmark || parseInt(index, 10) >= parseInt(currentBookmark, 10)) { app.removeAlert('bookmark'); } - } diff --git a/public/src/client/topic/delete-posts.js b/public/src/client/topic/delete-posts.js index c770bf045a..c2fde4ec25 100644 --- a/public/src/client/topic/delete-posts.js +++ b/public/src/client/topic/delete-posts.js @@ -2,7 +2,6 @@ define('forum/topic/delete-posts', ['components', 'postSelect'], function (components, postSelect) { - var DeletePosts = {}; var modal; var deleteBtn; diff --git a/public/src/client/topic/events.js b/public/src/client/topic/events.js index d88a0dee54..d87aac6f75 100644 --- a/public/src/client/topic/events.js +++ b/public/src/client/topic/events.js @@ -9,7 +9,6 @@ define('forum/topic/events', [ 'components', 'translator', ], function (postTools, threadTools, posts, components, translator) { - var Events = {}; var events = { diff --git a/public/src/client/topic/flag.js b/public/src/client/topic/flag.js index cb46377641..c9904d3011 100644 --- a/public/src/client/topic/flag.js +++ b/public/src/client/topic/flag.js @@ -2,7 +2,6 @@ define('forum/topic/flag', [], function () { - var Flag = {}; var flagModal; var flagCommit; diff --git a/public/src/client/topic/fork.js b/public/src/client/topic/fork.js index 8cc5035e2c..b34d50d55f 100644 --- a/public/src/client/topic/fork.js +++ b/public/src/client/topic/fork.js @@ -2,7 +2,6 @@ define('forum/topic/fork', ['components', 'postSelect'], function (components, postSelect) { - var Fork = {}; var forkModal; var forkCommit; diff --git a/public/src/client/topic/move-post.js b/public/src/client/topic/move-post.js index 45845bbcf7..3c848be9ff 100644 --- a/public/src/client/topic/move-post.js +++ b/public/src/client/topic/move-post.js @@ -2,7 +2,6 @@ define('forum/topic/move-post', [], function () { - var MovePost = {}; @@ -33,7 +32,6 @@ define('forum/topic/move-post', [], function () { topicId.val(''); }); }); - }); }; diff --git a/public/src/client/topic/move.js b/public/src/client/topic/move.js index 85be9013dc..4d038637ca 100644 --- a/public/src/client/topic/move.js +++ b/public/src/client/topic/move.js @@ -2,7 +2,6 @@ define('forum/topic/move', function () { - var Move = {}; var modal; var selectedEl; @@ -22,7 +21,6 @@ define('forum/topic/move', function () { } parseModal(categories, function () { - modal.on('hidden.bs.modal', function () { modal.remove(); }); diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js index 903c90f4df..22d92750eb 100644 --- a/public/src/client/topic/postTools.js +++ b/public/src/client/topic/postTools.js @@ -9,7 +9,6 @@ define('forum/topic/postTools', [ 'forum/topic/votes', 'forum/topic/move-post', ], function (share, navigator, components, translator, votes, movePost) { - var PostTools = {}; var staleReplyAnyway = false; @@ -231,7 +230,6 @@ define('forum/topic/postTools', [ var selectedNode = getSelectedNode(); showStaleWarning(function () { - function quote(text) { $(window).trigger('action:composer.addQuote', { tid: tid, diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.js index 9ab48cbeaa..5711c4513f 100644 --- a/public/src/client/topic/posts.js +++ b/public/src/client/topic/posts.js @@ -8,7 +8,6 @@ define('forum/topic/posts', [ 'navigator', 'components', ], function (pagination, infinitescroll, postTools, navigator, components) { - var Posts = { _imageLoaderTimeout: undefined, }; @@ -178,7 +177,6 @@ define('forum/topic/posts', [ $(window).trigger('action:posts.loading', {posts: data.posts, after: after, before: before}); app.parseAndTranslate('topic', 'posts', data, function (html) { - html = html.filter(function () { var pid = $(this).attr('data-pid'); return pid && $('[component="post"][data-pid="' + pid + '"]').length === 0; @@ -396,5 +394,4 @@ define('forum/topic/posts', [ } return Posts; - }); diff --git a/public/src/client/topic/replies.js b/public/src/client/topic/replies.js index be54d7027d..3d2f0f72af 100644 --- a/public/src/client/topic/replies.js +++ b/public/src/client/topic/replies.js @@ -2,7 +2,6 @@ define('forum/topic/replies', ['navigator', 'components', 'forum/topic/posts'], function (navigator, components, posts) { - var Replies = {}; Replies.init = function (tid) { diff --git a/public/src/client/topic/threadTools.js b/public/src/client/topic/threadTools.js index 88eb4940c1..ad5a262222 100644 --- a/public/src/client/topic/threadTools.js +++ b/public/src/client/topic/threadTools.js @@ -8,11 +8,9 @@ define('forum/topic/threadTools', [ 'components', 'translator', ], function (fork, move, deletePosts, components, translator) { - var ThreadTools = {}; ThreadTools.init = function (tid) { - renderMenu(); var topicContainer = $('.topic'); diff --git a/public/src/client/topic/votes.js b/public/src/client/topic/votes.js index ea0ad4291e..824cfeb2a1 100644 --- a/public/src/client/topic/votes.js +++ b/public/src/client/topic/votes.js @@ -2,7 +2,6 @@ define('forum/topic/votes', ['components', 'translator'], function (components, translator) { - var Votes = {}; Votes.addVoteHandler = function () { @@ -105,7 +104,6 @@ define('forum/topic/votes', ['components', 'translator'], function (components, dialog.on('click', function () { dialog.modal('hide'); }); - }); }); }); diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js index ef5f844d64..8b493ff111 100644 --- a/public/src/modules/chat.js +++ b/public/src/modules/chat.js @@ -11,7 +11,6 @@ define('chat', [ 'translator', 'scrollStop', ], function (components, taskbar, S, sounds, Chats, ChatsMessages, translator, scrollStop) { - var module = {}; var newMessage = false; @@ -157,7 +156,6 @@ define('chat', [ module.createModal = function (data, callback) { app.parseAndTranslate('chat', data, function (chatModal) { - var uuid = utils.generateUUID(); var dragged = false; diff --git a/public/src/modules/coverPhoto.js b/public/src/modules/coverPhoto.js index a2aee26775..8cae013101 100644 --- a/public/src/modules/coverPhoto.js +++ b/public/src/modules/coverPhoto.js @@ -4,7 +4,6 @@ define('coverPhoto', [ 'vendor/jquery/draggable-background/backgroundDraggable', ], function () { - var coverPhoto = { coverEl: null, saveFn: null, diff --git a/public/src/modules/helpers.js b/public/src/modules/helpers.js index 98d8aeae7b..030e6333e0 100644 --- a/public/src/modules/helpers.js +++ b/public/src/modules/helpers.js @@ -280,7 +280,6 @@ if (typeof define === 'function' && define.amd) { define('helpers', exports); } - }( typeof exports === 'object' ? exports : typeof define === 'function' && define.amd ? {} : diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js index 62d5bbb788..96ed332e98 100644 --- a/public/src/modules/navigator.js +++ b/public/src/modules/navigator.js @@ -3,7 +3,6 @@ define('navigator', ['forum/pagination', 'components'], function (pagination, components) { - var navigator = {}; var index = 1; var count = 0; diff --git a/public/src/modules/search.js b/public/src/modules/search.js index b4ceec533c..65f68af699 100644 --- a/public/src/modules/search.js +++ b/public/src/modules/search.js @@ -2,7 +2,6 @@ define('search', ['navigator', 'translator'], function (nav, translator) { - var Search = { current: {}, }; diff --git a/public/src/modules/settings.js b/public/src/modules/settings.js index 04d88e40cd..11e317e067 100644 --- a/public/src/modules/settings.js +++ b/public/src/modules/settings.js @@ -2,7 +2,6 @@ define('settings', function () { - var DEFAULT_PLUGINS = [ 'settings/checkbox', 'settings/number', @@ -541,5 +540,4 @@ define('settings', function () { }); return Settings; - }); diff --git a/public/src/modules/settings/array.js b/public/src/modules/settings/array.js index e2f606d1db..3a0bdea922 100644 --- a/public/src/modules/settings/array.js +++ b/public/src/modules/settings/array.js @@ -1,7 +1,6 @@ 'use strict'; define('settings/array', function () { - var Settings = null; var SettingsArray; var helper = null; @@ -145,5 +144,4 @@ define('settings/array', function () { }; return SettingsArray; - }); diff --git a/public/src/modules/settings/checkbox.js b/public/src/modules/settings/checkbox.js index e1fd6fd614..6d36849b6a 100644 --- a/public/src/modules/settings/checkbox.js +++ b/public/src/modules/settings/checkbox.js @@ -1,7 +1,6 @@ 'use strict'; define('settings/checkbox', function () { - var Settings = null; var SettingsCheckbox; @@ -35,5 +34,4 @@ define('settings/checkbox', function () { }; return SettingsCheckbox; - }); diff --git a/public/src/modules/settings/key.js b/public/src/modules/settings/key.js index d5cf969693..d6eb183c77 100644 --- a/public/src/modules/settings/key.js +++ b/public/src/modules/settings/key.js @@ -1,7 +1,6 @@ 'use strict'; define('settings/key', function () { - var Settings = null; var SettingsKey; var helper = null; @@ -219,5 +218,4 @@ define('settings/key', function () { }; return SettingsKey; - }); diff --git a/public/src/modules/settings/number.js b/public/src/modules/settings/number.js index e8703eef28..52dd38fe44 100644 --- a/public/src/modules/settings/number.js +++ b/public/src/modules/settings/number.js @@ -1,7 +1,6 @@ 'use strict'; define('settings/number', function () { - return { types: ['number'], get: function (element, trim, empty) { @@ -12,5 +11,4 @@ define('settings/number', function () { return value ? +value : 0; }, }; - }); diff --git a/public/src/modules/settings/object.js b/public/src/modules/settings/object.js index 5f4d897700..d100261691 100644 --- a/public/src/modules/settings/object.js +++ b/public/src/modules/settings/object.js @@ -1,7 +1,6 @@ 'use strict'; define('settings/object', function () { - var Settings = null; var SettingsObject; var helper = null; @@ -117,5 +116,4 @@ define('settings/object', function () { }; return SettingsObject; - }); diff --git a/public/src/modules/settings/select.js b/public/src/modules/settings/select.js index 164d2c2cb7..d90c03c4fd 100644 --- a/public/src/modules/settings/select.js +++ b/public/src/modules/settings/select.js @@ -1,7 +1,6 @@ 'use strict'; define('settings/select', function () { - var Settings = null; var SettingsSelect; @@ -47,5 +46,4 @@ define('settings/select', function () { }; return SettingsSelect; - }); diff --git a/public/src/modules/settings/textarea.js b/public/src/modules/settings/textarea.js index d8e4cb2268..0397e5bea5 100644 --- a/public/src/modules/settings/textarea.js +++ b/public/src/modules/settings/textarea.js @@ -1,7 +1,6 @@ 'use strict'; define('settings/textarea', function () { - var Settings = null; var SettingsArea; @@ -33,5 +32,4 @@ define('settings/textarea', function () { }; return SettingsArea; - }); diff --git a/public/src/modules/share.js b/public/src/modules/share.js index cdfd755bb0..f9d81a9690 100644 --- a/public/src/modules/share.js +++ b/public/src/modules/share.js @@ -2,11 +2,9 @@ define('share', function () { - var module = {}; module.addShareHandlers = function (name) { - var baseUrl = window.location.protocol + '//' + window.location.host; function openShare(url, urlToPost, width, height) { @@ -15,7 +13,6 @@ define('share', function () { } $('#content').off('shown.bs.dropdown', '.share-dropdown').on('shown.bs.dropdown', '.share-dropdown', function () { - var postLink = $(this).find('.post-link'); postLink.val(baseUrl + getPostUrl($(this))); diff --git a/public/src/modules/topicSelect.js b/public/src/modules/topicSelect.js index 46d3a9ffe7..185e5e36a0 100644 --- a/public/src/modules/topicSelect.js +++ b/public/src/modules/topicSelect.js @@ -51,7 +51,6 @@ define('topicSelect', ['components'], function (components) { }; function selectRange(clickedTid) { - if (!lastSelected) { lastSelected = $('[component="category/topic"]').first().find('[component="topic/select"]'); } diff --git a/public/src/modules/uploader.js b/public/src/modules/uploader.js index 22fff0bc19..e986065ed5 100644 --- a/public/src/modules/uploader.js +++ b/public/src/modules/uploader.js @@ -2,7 +2,6 @@ define('uploader', ['translator'], function (translator) { - var module = {}; module.open = function (route, params, fileSize, callback) { diff --git a/public/src/overrides.js b/public/src/overrides.js index c3c2d64040..27ba05c74b 100644 --- a/public/src/overrides.js +++ b/public/src/overrides.js @@ -4,7 +4,6 @@ var overrides = overrides || {}; if ('undefined' !== typeof window) { - (function ($, undefined) { require(['translator'], function (translator) { $.fn.getCursorPosition = function () { @@ -135,5 +134,4 @@ if ('undefined' !== typeof window) { timeagoFn.apply(this, arguments); }; }; - } diff --git a/public/src/sockets.js b/public/src/sockets.js index 8105524d22..50a3c5504f 100644 --- a/public/src/sockets.js +++ b/public/src/sockets.js @@ -124,5 +124,4 @@ app.isConnected = false; function onEventBanned() { window.location.href = config.relative_path + '/'; } - }()); diff --git a/public/src/utils.js b/public/src/utils.js index 16cd44d998..2c2f4ac4dd 100644 --- a/public/src/utils.js +++ b/public/src/utils.js @@ -17,7 +17,6 @@ var diff = process.hrtime(start); return (diff[0] * 1e3) + (diff[1] / 1e6); }; - } else { XRegExp = window.XRegExp; } @@ -479,7 +478,6 @@ if ('undefined' !== typeof window) { window.utils = module.exports; } - }('undefined' === typeof module ? { module: { exports: {}, diff --git a/src/categories.js b/src/categories.js index ea795320bb..1297c0fc65 100644 --- a/src/categories.js +++ b/src/categories.js @@ -10,7 +10,6 @@ var plugins = require('./plugins'); var privileges = require('./privileges'); (function (Categories) { - require('./categories/data')(Categories); require('./categories/create')(Categories); require('./categories/delete')(Categories); @@ -363,6 +362,4 @@ var privileges = require('./privileges'); }, ], callback); }; - - }(exports)); diff --git a/src/categories/activeusers.js b/src/categories/activeusers.js index 148db6aceb..5ce28c4b11 100644 --- a/src/categories/activeusers.js +++ b/src/categories/activeusers.js @@ -5,7 +5,6 @@ var posts = require('../posts'); var db = require('../database'); module.exports = function (Categories) { - Categories.getActiveUsers = function (cid, callback) { async.waterfall([ function (next) { diff --git a/src/categories/create.js b/src/categories/create.js index 0673e7929c..5be36db37b 100644 --- a/src/categories/create.js +++ b/src/categories/create.js @@ -9,7 +9,6 @@ var privileges = require('../privileges'); var utils = require('../../public/src/utils'); module.exports = function (Categories) { - Categories.create = function (data, callback) { var category; var parentCid = data.parentCid ? data.parentCid : 0; @@ -168,5 +167,4 @@ module.exports = function (Categories) { }, ], callback); } - }; diff --git a/src/categories/data.js b/src/categories/data.js index 9c15fbb2d4..06bd3acfe9 100644 --- a/src/categories/data.js +++ b/src/categories/data.js @@ -7,7 +7,6 @@ var winston = require('winston'); var db = require('../database'); module.exports = function (Categories) { - Categories.getCategoryData = function (cid, callback) { db.getObject('category:' + cid, function (err, category) { if (err) { @@ -111,5 +110,4 @@ module.exports = function (Categories) { Categories.incrementCategoryFieldBy = function (cid, field, value, callback) { db.incrObjectFieldBy('category:' + cid, field, value, callback); }; - }; diff --git a/src/categories/delete.js b/src/categories/delete.js index 20aef52472..58dcbcee41 100644 --- a/src/categories/delete.js +++ b/src/categories/delete.js @@ -9,7 +9,6 @@ var groups = require('../groups'); var privileges = require('../privileges'); module.exports = function (Categories) { - Categories.purge = function (cid, uid, callback) { async.waterfall([ function (next) { diff --git a/src/categories/recentreplies.js b/src/categories/recentreplies.js index 33572aabbc..4570a177fe 100644 --- a/src/categories/recentreplies.js +++ b/src/categories/recentreplies.js @@ -14,7 +14,6 @@ var batch = require('../batch'); module.exports = function (Categories) { - Categories.getRecentReplies = function (cid, uid, count, callback) { if (!parseInt(count, 10)) { return callback(null, []); diff --git a/src/categories/topics.js b/src/categories/topics.js index f487846f1b..4be2298b08 100644 --- a/src/categories/topics.js +++ b/src/categories/topics.js @@ -7,7 +7,6 @@ var topics = require('../topics'); var plugins = require('../plugins'); module.exports = function (Categories) { - Categories.getCategoryTopics = function (data, callback) { async.waterfall([ function (next) { @@ -142,5 +141,4 @@ module.exports = function (Categories) { }, ], callback); }; - }; diff --git a/src/categories/unread.js b/src/categories/unread.js index bb7c9d6432..68cb957fe8 100644 --- a/src/categories/unread.js +++ b/src/categories/unread.js @@ -5,7 +5,6 @@ var async = require('async'); var db = require('../database'); module.exports = function (Categories) { - Categories.markAsRead = function (cids, uid, callback) { callback = callback || function () {}; if (!Array.isArray(cids) || !cids.length) { @@ -53,5 +52,4 @@ module.exports = function (Categories) { Categories.hasReadCategory = function (cid, uid, callback) { db.isSetMember('cid:' + cid + ':read_by_uid', uid, callback); }; - }; diff --git a/src/categories/update.js b/src/categories/update.js index b8f15ac1f5..1dc588405b 100644 --- a/src/categories/update.js +++ b/src/categories/update.js @@ -10,9 +10,7 @@ var translator = require('../../public/src/modules/translator'); var plugins = require('../plugins'); module.exports = function (Categories) { - Categories.update = function (modified, callback) { - var cids = Object.keys(modified); async.each(cids, function (cid, next) { @@ -166,5 +164,4 @@ module.exports = function (Categories) { }, ], callback); }; - }; diff --git a/src/controllers/admin/events.js b/src/controllers/admin/events.js index 190b5b612e..97838d2266 100644 --- a/src/controllers/admin/events.js +++ b/src/controllers/admin/events.js @@ -10,7 +10,6 @@ var eventsController = {}; eventsController.get = function (req, res, next) { - var page = parseInt(req.query.page, 10) || 1; var itemsPerPage = 20; var start = (page - 1) * itemsPerPage; diff --git a/src/controllers/category.js b/src/controllers/category.js index 0e68d5a5ce..ce5f7b5e07 100644 --- a/src/controllers/category.js +++ b/src/controllers/category.js @@ -124,7 +124,6 @@ categoryController.get = function (req, res, callback) { ], next); }, function (categoryData, next) { - categories.modifyTopicsByPrivilege(categoryData.topics, userPrivileges); if (categoryData.link) { diff --git a/src/controllers/index.js b/src/controllers/index.js index 0f16a19f27..1a54a5e8f0 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -147,7 +147,6 @@ Controllers.login = function (req, res, next) { } else { res.render('login', data); } - }; Controllers.register = function (req, res, next) { @@ -413,8 +412,6 @@ Controllers.handleURIErrors = function (err, req, res, next) { }); } } - - } else { next(err); } diff --git a/src/controllers/popular.js b/src/controllers/popular.js index daff632f12..1daf7f5ed5 100644 --- a/src/controllers/popular.js +++ b/src/controllers/popular.js @@ -18,7 +18,6 @@ var terms = { }; popularController.get = function (req, res, next) { - var term = terms[req.params.term]; if (!term && req.params.term) { diff --git a/src/controllers/topics.js b/src/controllers/topics.js index d74152a37a..4d6f87b68f 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -128,7 +128,6 @@ topicsController.get = function (req, res, callback) { plugins.fireHook('filter:controllers.topic.get', {topicData: topicData, uid: req.uid}, next); }, function (data, next) { - var breadcrumbs = [ { text: data.topicData.category.name, diff --git a/src/controllers/uploads.js b/src/controllers/uploads.js index a82ff32818..0a556f722a 100644 --- a/src/controllers/uploads.js +++ b/src/controllers/uploads.js @@ -115,7 +115,6 @@ function resizeImage(fileObj, callback) { }, next); }, function (next) { - // Return the resized version to the composer/postData var dirname = path.dirname(fileObj.url); var extname = path.extname(fileObj.url); diff --git a/src/database/mongo.js b/src/database/mongo.js index d82d1527c3..9bc321703b 100644 --- a/src/database/mongo.js +++ b/src/database/mongo.js @@ -2,7 +2,6 @@ 'use strict'; (function (module) { - var winston = require('winston'); var async = require('async'); var nconf = require('nconf'); @@ -246,5 +245,4 @@ module.close = function () { db.close(); }; - }(exports)); diff --git a/src/database/mongo/sorted.js b/src/database/mongo/sorted.js index cf9dfecc99..1d93bbcaab 100644 --- a/src/database/mongo/sorted.js +++ b/src/database/mongo/sorted.js @@ -503,5 +503,4 @@ module.exports = function (db, module) { callback ); }; - }; diff --git a/src/database/mongo/sorted/add.js b/src/database/mongo/sorted/add.js index 2abae99d49..acbb279985 100644 --- a/src/database/mongo/sorted/add.js +++ b/src/database/mongo/sorted/add.js @@ -1,7 +1,6 @@ 'use strict'; module.exports = function (db, module) { - var helpers = module.helpers.mongo; module.sortedSetAdd = function (key, score, value, callback) { @@ -61,5 +60,4 @@ module.exports = function (db, module) { callback(err); }); }; - }; diff --git a/src/database/mongo/sorted/intersect.js b/src/database/mongo/sorted/intersect.js index 74b7d1596b..dc1d4ef54c 100644 --- a/src/database/mongo/sorted/intersect.js +++ b/src/database/mongo/sorted/intersect.js @@ -1,7 +1,6 @@ 'use strict'; module.exports = function (db, module) { - module.sortedSetIntersectCard = function (keys, callback) { if (!Array.isArray(keys) || !keys.length) { return callback(null, 0); @@ -103,5 +102,4 @@ module.exports = function (db, module) { callback(null, data); }); } - }; diff --git a/src/database/mongo/sorted/remove.js b/src/database/mongo/sorted/remove.js index e7f547995c..cceb4e0c6a 100644 --- a/src/database/mongo/sorted/remove.js +++ b/src/database/mongo/sorted/remove.js @@ -1,7 +1,6 @@ 'use strict'; module.exports = function (db, module) { - var helpers = module.helpers.mongo; module.sortedSetRemove = function (key, value, callback) { @@ -53,5 +52,4 @@ module.exports = function (db, module) { callback(err); }); }; - }; diff --git a/src/database/mongo/sorted/union.js b/src/database/mongo/sorted/union.js index 36f5c545ad..ee8ae3e261 100644 --- a/src/database/mongo/sorted/union.js +++ b/src/database/mongo/sorted/union.js @@ -1,7 +1,6 @@ 'use strict'; module.exports = function (db, module) { - module.sortedSetUnionCard = function (keys, callback) { if (!Array.isArray(keys) || !keys.length) { return callback(null, 0); @@ -81,5 +80,4 @@ module.exports = function (db, module) { callback(null, data); }); } - }; diff --git a/src/database/redis.js b/src/database/redis.js index 41dc300d54..d076476f20 100644 --- a/src/database/redis.js +++ b/src/database/redis.js @@ -1,7 +1,6 @@ 'use strict'; (function (module) { - var winston = require('winston'); var nconf = require('nconf'); var semver = require('semver'); diff --git a/src/database/redis/hash.js b/src/database/redis/hash.js index 756b82614c..2a83630f4b 100644 --- a/src/database/redis/hash.js +++ b/src/database/redis/hash.js @@ -1,7 +1,6 @@ 'use strict'; module.exports = function (redisClient, module) { - var helpers = module.helpers.redis; module.setObject = function (key, data, callback) { diff --git a/src/database/redis/main.js b/src/database/redis/main.js index 1ddef46355..1ab8a7ff13 100644 --- a/src/database/redis/main.js +++ b/src/database/redis/main.js @@ -1,7 +1,6 @@ 'use strict'; module.exports = function (redisClient, module) { - module.flushdb = function (callback) { redisClient.send_command('flushdb', [], function (err) { if (typeof callback === 'function') { diff --git a/src/database/redis/sorted.js b/src/database/redis/sorted.js index 9fa7e07694..feb8a4cc27 100644 --- a/src/database/redis/sorted.js +++ b/src/database/redis/sorted.js @@ -1,7 +1,6 @@ 'use strict'; module.exports = function (redisClient, module) { - var utils = require('../../../public/src/utils'); var helpers = module.helpers.redis; diff --git a/src/database/redis/sorted/add.js b/src/database/redis/sorted/add.js index 96b99a4376..e60d079eac 100644 --- a/src/database/redis/sorted/add.js +++ b/src/database/redis/sorted/add.js @@ -1,7 +1,6 @@ 'use strict'; module.exports = function (redisClient, module) { - module.sortedSetAdd = function (key, score, value, callback) { callback = callback || function () {}; if (Array.isArray(score) && Array.isArray(value)) { @@ -44,6 +43,4 @@ module.exports = function (redisClient, module) { callback(err); }); }; - - }; diff --git a/src/database/redis/sorted/intersect.js b/src/database/redis/sorted/intersect.js index 6ba6d45515..aeb68d02ef 100644 --- a/src/database/redis/sorted/intersect.js +++ b/src/database/redis/sorted/intersect.js @@ -2,7 +2,6 @@ 'use strict'; module.exports = function (redisClient, module) { - module.sortedSetIntersectCard = function (keys, callback) { if (!Array.isArray(keys) || !keys.length) { return callback(null, 0); diff --git a/src/database/redis/sorted/remove.js b/src/database/redis/sorted/remove.js index 1bf86db414..eacb6ca861 100644 --- a/src/database/redis/sorted/remove.js +++ b/src/database/redis/sorted/remove.js @@ -2,7 +2,6 @@ 'use strict'; module.exports = function (redisClient, module) { - var helpers = module.helpers.redis; module.sortedSetRemove = function (key, value, callback) { diff --git a/src/database/redis/sorted/union.js b/src/database/redis/sorted/union.js index 24c1440249..88bdd3e7bf 100644 --- a/src/database/redis/sorted/union.js +++ b/src/database/redis/sorted/union.js @@ -2,7 +2,6 @@ 'use strict'; module.exports = function (redisClient, module) { - module.sortedSetUnionCard = function (keys, callback) { var tempSetName = 'temp_' + Date.now(); @@ -30,7 +29,6 @@ module.exports = function (redisClient, module) { }; module.sortedSetUnion = function (params, callback) { - var tempSetName = 'temp_' + Date.now(); var rangeParams = [tempSetName, params.start, params.stop]; diff --git a/src/emailer.js b/src/emailer.js index 2a1298ac8c..09b58a20c3 100644 --- a/src/emailer.js +++ b/src/emailer.js @@ -163,6 +163,5 @@ var fallbackTransport; return parsed.hostname; } - }(module.exports)); diff --git a/src/events.js b/src/events.js index 79ee5a0b8d..9665ec265f 100644 --- a/src/events.js +++ b/src/events.js @@ -132,6 +132,4 @@ var utils = require('../public/src/utils'); events.deleteEvents(eids, next); }, {alwaysStartAt: 0}, callback); }; - - }(module.exports)); diff --git a/src/groups.js b/src/groups.js index 651e2adde7..07d8a2347b 100644 --- a/src/groups.js +++ b/src/groups.js @@ -11,7 +11,6 @@ var privileges = require('./privileges'); var utils = require('../public/src/utils'); (function (Groups) { - require('./groups/create')(Groups); require('./groups/delete')(Groups); require('./groups/update')(Groups); @@ -454,5 +453,4 @@ var utils = require('../public/src/utils'); }, ], callback); }; - }(module.exports)); diff --git a/src/groups/cover.js b/src/groups/cover.js index c2a351cde7..0f56621212 100644 --- a/src/groups/cover.js +++ b/src/groups/cover.js @@ -13,7 +13,6 @@ var db = require('../database'); var uploadsController = require('../controllers/uploads'); module.exports = function (Groups) { - Groups.updateCoverPosition = function (groupName, position, callback) { if (!groupName) { return callback(new Error('[[error:invalid-data]]')); @@ -22,7 +21,6 @@ module.exports = function (Groups) { }; Groups.updateCover = function (uid, data, callback) { - // Position only? That's fine if (!data.imageData && !data.file && data.position) { return Groups.updateCoverPosition(data.groupName, data.position, callback); @@ -118,5 +116,4 @@ module.exports = function (Groups) { Groups.removeCover = function (data, callback) { db.deleteObjectFields('group:' + data.groupName, ['cover:url', 'cover:thumb:url', 'cover:position'], callback); }; - }; diff --git a/src/groups/create.js b/src/groups/create.js index 3fba2851a4..eef4eda5f0 100644 --- a/src/groups/create.js +++ b/src/groups/create.js @@ -7,7 +7,6 @@ var utils = require('../../public/src/utils'); var db = require('../database'); module.exports = function (Groups) { - Groups.create = function (data, callback) { var system = isSystemGroup(data); var groupData; @@ -74,7 +73,6 @@ module.exports = function (Groups) { next(null, groupData); }, ], callback); - }; function isSystemGroup(data) { diff --git a/src/groups/delete.js b/src/groups/delete.js index 431dd510c2..6aed7173a2 100644 --- a/src/groups/delete.js +++ b/src/groups/delete.js @@ -6,7 +6,6 @@ var utils = require('../../public/src/utils'); var db = require('./../database'); module.exports = function (Groups) { - Groups.destroy = function (groupName, callback) { Groups.getGroupsData([groupName], function (err, groupsData) { if (err) { diff --git a/src/groups/membership.js b/src/groups/membership.js index d3908b135e..268edc6eca 100644 --- a/src/groups/membership.js +++ b/src/groups/membership.js @@ -19,7 +19,6 @@ var cache = LRU({ }); module.exports = function (Groups) { - Groups.cache = cache; Groups.join = function (groupName, uid, callback) { diff --git a/src/groups/ownership.js b/src/groups/ownership.js index 9bb007a7da..779644d2a9 100644 --- a/src/groups/ownership.js +++ b/src/groups/ownership.js @@ -5,7 +5,6 @@ var db = require('../database'); var plugins = require('../plugins'); module.exports = function (Groups) { - Groups.ownership = {}; Groups.ownership.isOwner = function (uid, groupName, callback) { diff --git a/src/groups/search.js b/src/groups/search.js index 865d0619ca..00bcee3967 100644 --- a/src/groups/search.js +++ b/src/groups/search.js @@ -7,7 +7,6 @@ var db = require('./../database'); module.exports = function (Groups) { - Groups.search = function (query, options, callback) { if (!query) { return callback(null, []); @@ -64,7 +63,6 @@ module.exports = function (Groups) { }; Groups.searchMembers = function (data, callback) { - function findUids(query, searchBy, callback) { query = query.toLowerCase(); @@ -112,7 +110,6 @@ module.exports = function (Groups) { Groups.ownership.isOwners(uids, data.groupName, next); }, function (isOwners, next) { - results.users.forEach(function (user, index) { if (user) { user.isOwner = isOwners[index]; diff --git a/src/groups/update.js b/src/groups/update.js index c5fe6f5749..99e8dcc65a 100644 --- a/src/groups/update.js +++ b/src/groups/update.js @@ -9,7 +9,6 @@ var db = require('../database'); module.exports = function (Groups) { - Groups.update = function (groupName, values, callback) { callback = callback || function () {}; diff --git a/src/install.js b/src/install.js index cb44f75589..126c96ae79 100644 --- a/src/install.js +++ b/src/install.js @@ -430,7 +430,6 @@ function createWelcomePost(next) { } function enableDefaultPlugins(next) { - process.stdout.write('Enabling default plugins\n'); var defaultEnabled = [ @@ -493,7 +492,6 @@ function setCopyrightWidget(next) { } install.setup = function (callback) { - async.series([ checkSetupFlag, checkCIFlag, diff --git a/src/logger.js b/src/logger.js index 186dd62992..3e0c1996d2 100644 --- a/src/logger.js +++ b/src/logger.js @@ -31,8 +31,6 @@ var opts = { /* -- Logger -- */ (function (Logger) { - - Logger.init = function (app) { opts.express.app = app; /* Open log file stream & initialize express logging if meta.config.logger* variables are set */ @@ -86,7 +84,6 @@ var opts = { } } else { stream = fs.createWriteStream(value, {flags: 'a'}); - } if (stream) { @@ -222,5 +219,4 @@ var opts = { socket.$emit = override($emit, 'on', 'Logger.io_one: $emit.apply: Failed'); } }; - }(exports)); diff --git a/src/messaging/create.js b/src/messaging/create.js index 80eb198444..2c6ac84ffb 100644 --- a/src/messaging/create.js +++ b/src/messaging/create.js @@ -8,7 +8,6 @@ var db = require('../database'); module.exports = function (Messaging) { - Messaging.sendMessage = function (uid, roomId, content, timestamp, callback) { async.waterfall([ function (next) { diff --git a/src/messaging/data.js b/src/messaging/data.js index ce7b0a7e38..e3cb67fbd8 100644 --- a/src/messaging/data.js +++ b/src/messaging/data.js @@ -8,7 +8,6 @@ var user = require('../user'); var utils = require('../../public/src/utils'); module.exports = function (Messaging) { - Messaging.getMessageField = function (mid, field, callback) { Messaging.getMessageFields(mid, [field], function (err, fields) { callback(err, fields ? fields[field] : null); @@ -28,7 +27,6 @@ module.exports = function (Messaging) { }; Messaging.getMessagesData = function (mids, uid, roomId, isNew, callback) { - var messages; async.waterfall([ @@ -132,5 +130,4 @@ module.exports = function (Messaging) { }, ], callback); }; - }; diff --git a/src/messaging/delete.js b/src/messaging/delete.js index 633ac62b22..6fdf5177ef 100644 --- a/src/messaging/delete.js +++ b/src/messaging/delete.js @@ -4,7 +4,6 @@ var async = require('async'); var db = require('../database'); module.exports = function (Messaging) { - Messaging.deleteMessage = function (mid, roomId, callback) { async.waterfall([ function (next) { diff --git a/src/messaging/edit.js b/src/messaging/edit.js index 96b6385681..f9c664d67f 100644 --- a/src/messaging/edit.js +++ b/src/messaging/edit.js @@ -9,7 +9,6 @@ var sockets = require('../socket.io'); module.exports = function (Messaging) { - Messaging.editMessage = function (uid, mid, roomId, content, callback) { var uids; async.waterfall([ @@ -78,5 +77,4 @@ module.exports = function (Messaging) { }, ], callback); }; - }; diff --git a/src/messaging/notifications.js b/src/messaging/notifications.js index 72a7392afb..8578eb6425 100644 --- a/src/messaging/notifications.js +++ b/src/messaging/notifications.js @@ -11,7 +11,6 @@ var meta = require('../meta'); var sockets = require('../socket.io'); module.exports = function (Messaging) { - Messaging.notifyQueue = {}; // Only used to notify a user of a new chat message, see Messaging.notifyUser Messaging.notifyUsersInRoom = function (fromUid, roomId, messageObj) { diff --git a/src/messaging/rooms.js b/src/messaging/rooms.js index 07df01e79d..0356daec64 100644 --- a/src/messaging/rooms.js +++ b/src/messaging/rooms.js @@ -8,7 +8,6 @@ var user = require('../user'); var plugins = require('../plugins'); module.exports = function (Messaging) { - Messaging.getRoomData = function (roomId, callback) { db.getObject('chat:room:' + roomId, function (err, data) { if (err || !data) { @@ -222,5 +221,4 @@ module.exports = function (Messaging) { }, ], callback); }; - }; diff --git a/src/messaging/unread.js b/src/messaging/unread.js index dfcaa2b2f5..660eece5ce 100644 --- a/src/messaging/unread.js +++ b/src/messaging/unread.js @@ -6,7 +6,6 @@ var db = require('../database'); var sockets = require('../socket.io'); module.exports = function (Messaging) { - Messaging.getUnreadCount = function (uid, callback) { if (!parseInt(uid, 10)) { return callback(null, 0); @@ -51,5 +50,4 @@ module.exports = function (Messaging) { }, ], callback); }; - }; diff --git a/src/meta/configs.js b/src/meta/configs.js index 084a4d1463..82d8640e4c 100644 --- a/src/meta/configs.js +++ b/src/meta/configs.js @@ -9,7 +9,6 @@ var pubsub = require('../pubsub'); var cacheBuster = require('./cacheBuster'); module.exports = function (Meta) { - Meta.config = {}; Meta.configs = {}; @@ -140,5 +139,4 @@ module.exports = function (Meta) { Meta.configs.remove = function (field, callback) { db.deleteObjectField('config', field, callback); }; - }; diff --git a/src/meta/css.js b/src/meta/css.js index b3f75ae368..5454f29e46 100644 --- a/src/meta/css.js +++ b/src/meta/css.js @@ -16,7 +16,6 @@ var file = require('../file'); var utils = require('../../public/src/utils'); module.exports = function (Meta) { - Meta.css = {}; var buildImports = { diff --git a/src/meta/errors.js b/src/meta/errors.js index 58e381e270..085cb84fea 100644 --- a/src/meta/errors.js +++ b/src/meta/errors.js @@ -6,7 +6,6 @@ var db = require('../database'); var analytics = require('../analytics'); module.exports = function (Meta) { - Meta.errors = {}; Meta.errors.log404 = function (route, callback) { diff --git a/src/meta/js.js b/src/meta/js.js index 2b8d0db5df..189c0757de 100644 --- a/src/meta/js.js +++ b/src/meta/js.js @@ -13,7 +13,6 @@ var plugins = require('../plugins'); var utils = require('../../public/src/utils'); module.exports = function (Meta) { - Meta.js = { target: {}, scripts: { diff --git a/src/meta/logs.js b/src/meta/logs.js index c0b3f47137..e85c0a5e11 100644 --- a/src/meta/logs.js +++ b/src/meta/logs.js @@ -25,5 +25,4 @@ module.exports = function (Meta) { Meta.logs.clear = function (callback) { fs.truncate(Meta.logs.path, 0, callback); }; - }; diff --git a/src/meta/settings.js b/src/meta/settings.js index d29cdb753a..a1d13b248d 100644 --- a/src/meta/settings.js +++ b/src/meta/settings.js @@ -6,7 +6,6 @@ var db = require('../database'); var plugins = require('../plugins'); module.exports = function (Meta) { - Meta.settings = {}; Meta.settings.get = function (hash, callback) { diff --git a/src/meta/sounds.js b/src/meta/sounds.js index 6be040e0e3..249d49d49b 100644 --- a/src/meta/sounds.js +++ b/src/meta/sounds.js @@ -13,7 +13,6 @@ var plugins = require('../plugins'); var db = require('../database'); module.exports = function (Meta) { - Meta.sounds = {}; Meta.sounds.init = function (callback) { diff --git a/src/meta/themes.js b/src/meta/themes.js index bd796f0968..da1f5aa16f 100644 --- a/src/meta/themes.js +++ b/src/meta/themes.js @@ -56,7 +56,6 @@ module.exports = function (Meta) { next(null, null); } }); - }, function (err, themes) { if (err) { return callback(err); diff --git a/src/middleware/header.js b/src/middleware/header.js index 0706374c1a..670bf83303 100644 --- a/src/middleware/header.js +++ b/src/middleware/header.js @@ -15,7 +15,6 @@ var controllers = { }; module.exports = function (middleware) { - middleware.buildHeader = function (req, res, next) { res.locals.renderHeader = true; res.locals.isAPI = false; @@ -184,6 +183,5 @@ module.exports = function (middleware) { return title; } - }; diff --git a/src/middleware/headers.js b/src/middleware/headers.js index c31a307bf3..ae63b19124 100644 --- a/src/middleware/headers.js +++ b/src/middleware/headers.js @@ -3,7 +3,6 @@ var meta = require('../meta'); module.exports = function (middleware) { - middleware.addHeaders = function (req, res, next) { var headers = { 'X-Powered-By': encodeURI(meta.config['powered-by'] || 'NodeBB'), @@ -33,6 +32,5 @@ module.exports = function (middleware) { next(); }; - }; diff --git a/src/middleware/maintenance.js b/src/middleware/maintenance.js index c5c232e5e7..4f4cb03982 100644 --- a/src/middleware/maintenance.js +++ b/src/middleware/maintenance.js @@ -5,7 +5,6 @@ var meta = require('../meta'); var user = require('../user'); module.exports = function (middleware) { - middleware.maintenanceMode = function (req, res, next) { if (parseInt(meta.config.maintenanceMode, 10) !== 1) { return next(); @@ -36,5 +35,4 @@ module.exports = function (middleware) { }); }); }; - }; diff --git a/src/middleware/render.js b/src/middleware/render.js index 3f565353a1..0716869649 100644 --- a/src/middleware/render.js +++ b/src/middleware/render.js @@ -9,7 +9,6 @@ var plugins = require('../plugins'); var translator = require('../../public/src/modules/translator'); module.exports = function (middleware) { - middleware.processRender = function (req, res, next) { // res.render post-processing, modified from here: https://gist.github.com/mrlannigan/5051687 var render = res.render; @@ -129,5 +128,4 @@ module.exports = function (middleware) { }); return parts.join(' '); } - }; diff --git a/src/middleware/user.js b/src/middleware/user.js index 4c02702802..881820da0c 100644 --- a/src/middleware/user.js +++ b/src/middleware/user.js @@ -12,7 +12,6 @@ var controllers = { }; module.exports = function (middleware) { - middleware.checkGlobalPrivacySettings = function (req, res, next) { if (!req.user && !!parseInt(meta.config.privateUserInfo, 10)) { return middleware.authenticate(req, res, next); @@ -157,5 +156,4 @@ module.exports = function (middleware) { } } }; - }; diff --git a/src/notifications.js b/src/notifications.js index 6f20999229..06ebd64b61 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -16,7 +16,6 @@ var plugins = require('./plugins'); var utils = require('../public/src/utils'); (function (Notifications) { - Notifications.init = function () { winston.verbose('[notifications.init] Registering jobs.'); new cron('*/30 * * * *', Notifications.prune, null, true); @@ -510,6 +509,5 @@ var utils = require('../public/src/utils'); callback(err, data.notifications); }); }; - }(exports)); diff --git a/src/plugins.js b/src/plugins.js index c0b4ce980a..75b3c49b23 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -387,5 +387,4 @@ var middleware; }, ], callback); }; - }(exports)); diff --git a/src/plugins/hooks.js b/src/plugins/hooks.js index dc2093bf95..2441b24228 100644 --- a/src/plugins/hooks.js +++ b/src/plugins/hooks.js @@ -126,7 +126,6 @@ module.exports = function (Plugins) { return callback(); } async.each(hookList, function (hookObj, next) { - if (typeof hookObj.method !== 'function') { if (global.env === 'development') { winston.warn('[plugins] Expected method for hook \'' + hook + '\' in plugin \'' + hookObj.id + '\' not found, skipping.'); diff --git a/src/plugins/install.js b/src/plugins/install.js index c6bd030ca2..d3d70d9034 100644 --- a/src/plugins/install.js +++ b/src/plugins/install.js @@ -13,7 +13,6 @@ var pubsub = require('../pubsub'); module.exports = function (Plugins) { - if (nconf.get('isPrimary') === 'true') { pubsub.on('plugins:toggleInstall', function (data) { if (data.hostname !== os.hostname()) { diff --git a/src/posts.js b/src/posts.js index fe0ac57719..28126c7e0e 100644 --- a/src/posts.js +++ b/src/posts.js @@ -11,7 +11,6 @@ var privileges = require('./privileges'); var plugins = require('./plugins'); (function (Posts) { - require('./posts/create')(Posts); require('./posts/delete')(Posts); require('./posts/edit')(Posts); @@ -266,6 +265,4 @@ var plugins = require('./plugins'); } } }; - - }(exports)); diff --git a/src/posts/bookmarks.js b/src/posts/bookmarks.js index 27ead2ddb3..6038a50b54 100644 --- a/src/posts/bookmarks.js +++ b/src/posts/bookmarks.js @@ -6,7 +6,6 @@ var db = require('../database'); var plugins = require('../plugins'); module.exports = function (Posts) { - Posts.bookmark = function (pid, uid, callback) { toggleBookmark('bookmark', pid, uid, callback); }; diff --git a/src/posts/category.js b/src/posts/category.js index 49876874ca..cb9a2566c4 100644 --- a/src/posts/category.js +++ b/src/posts/category.js @@ -8,7 +8,6 @@ var db = require('../database'); var topics = require('../topics'); module.exports = function (Posts) { - Posts.getCidByPid = function (pid, callback) { async.waterfall([ function (next) { diff --git a/src/posts/create.js b/src/posts/create.js index 6e21494137..43cd0817a3 100644 --- a/src/posts/create.js +++ b/src/posts/create.js @@ -12,7 +12,6 @@ var categories = require('../categories'); var utils = require('../../public/src/utils'); module.exports = function (Posts) { - Posts.create = function (data, callback) { // This is an internal method, consider using Topics.reply instead var uid = data.uid; @@ -36,7 +35,6 @@ module.exports = function (Posts) { db.incrObjectField('global', 'nextPid', next); }, function (pid, next) { - postData = { pid: pid, uid: uid, diff --git a/src/posts/delete.js b/src/posts/delete.js index b4dd13cc99..8076beb06b 100644 --- a/src/posts/delete.js +++ b/src/posts/delete.js @@ -10,7 +10,6 @@ var notifications = require('../notifications'); var plugins = require('../plugins'); module.exports = function (Posts) { - Posts.delete = function (pid, uid, callback) { var postData; async.waterfall([ @@ -294,6 +293,4 @@ module.exports = function (Posts) { ], callback); }); } - - }; diff --git a/src/posts/edit.js b/src/posts/edit.js index 2e0ba7a4a3..6d133f1395 100644 --- a/src/posts/edit.js +++ b/src/posts/edit.js @@ -14,7 +14,6 @@ var pubsub = require('../pubsub'); var utils = require('../../public/src/utils'); module.exports = function (Posts) { - pubsub.on('post:edit', function (pid) { cache.del(pid); }); @@ -153,6 +152,4 @@ module.exports = function (Posts) { ], callback); }); } - - }; diff --git a/src/posts/flags.js b/src/posts/flags.js index 744f64227f..f03cb9de59 100644 --- a/src/posts/flags.js +++ b/src/posts/flags.js @@ -9,7 +9,6 @@ var user = require('../user'); var analytics = require('../analytics'); module.exports = function (Posts) { - Posts.flag = function (post, uid, reason, callback) { if (!parseInt(uid, 10) || !reason) { return callback(); diff --git a/src/posts/parse.js b/src/posts/parse.js index f78a5debf1..02cd9fa307 100644 --- a/src/posts/parse.js +++ b/src/posts/parse.js @@ -13,7 +13,6 @@ var translator = require('../../public/src/modules/translator'); var urlRegex = /href="([^"]+)"/g; module.exports = function (Posts) { - Posts.parsePost = function (postData, callback) { postData.content = postData.content || ''; diff --git a/src/posts/summary.js b/src/posts/summary.js index 79d091012e..9e88303c1d 100644 --- a/src/posts/summary.js +++ b/src/posts/summary.js @@ -13,7 +13,6 @@ var utils = require('../../public/src/utils'); module.exports = function (Posts) { - Posts.getPostSummaryByPids = function (pids, uid, options, callback) { if (!Array.isArray(pids) || !pids.length) { return callback(null, []); diff --git a/src/posts/tools.js b/src/posts/tools.js index a93a19ef3c..c395eae457 100644 --- a/src/posts/tools.js +++ b/src/posts/tools.js @@ -70,6 +70,5 @@ module.exports = function (Posts) { }, ], callback); }; - }; diff --git a/src/posts/topics.js b/src/posts/topics.js index a33fd74bb3..eca6da493a 100644 --- a/src/posts/topics.js +++ b/src/posts/topics.js @@ -7,7 +7,6 @@ var topics = require('../topics'); var utils = require('../../public/src/utils'); module.exports = function (Posts) { - Posts.getPostsFromSet = function (set, start, stop, uid, reverse, callback) { async.waterfall([ function (next) { @@ -84,5 +83,4 @@ module.exports = function (Posts) { }, ], callback); }; - }; diff --git a/src/posts/user.js b/src/posts/user.js index b5687b34fa..74bc16b562 100644 --- a/src/posts/user.js +++ b/src/posts/user.js @@ -9,7 +9,6 @@ var meta = require('../meta'); var plugins = require('../plugins'); module.exports = function (Posts) { - Posts.getUserInfoForPosts = function (uids, uid, callback) { var groupsMap = {}; var userData; diff --git a/src/posts/votes.js b/src/posts/votes.js index d069f0f57a..449e929fd7 100644 --- a/src/posts/votes.js +++ b/src/posts/votes.js @@ -8,7 +8,6 @@ var user = require('../user'); var plugins = require('../plugins'); module.exports = function (Posts) { - var votesInProgress = {}; Posts.upvote = function (pid, uid, callback) { diff --git a/src/privileges/categories.js b/src/privileges/categories.js index 16e9d60b60..5e16fd1b17 100644 --- a/src/privileges/categories.js +++ b/src/privileges/categories.js @@ -11,7 +11,6 @@ var helpers = require('./helpers'); var plugins = require('../plugins'); module.exports = function (privileges) { - privileges.categories = {}; privileges.categories.list = function (cid, callback) { @@ -50,7 +49,6 @@ module.exports = function (privileges) { }), next); }, function (memberSets, next) { - memberSets = memberSets.map(function (set) { return set.map(function (uid) { return parseInt(uid, 10); @@ -87,7 +85,6 @@ module.exports = function (privileges) { }), next); }, function (memberSets, next) { - var uniqueGroups = _.unique(_.flatten(memberSets)); groups.getGroups('groups:createtime', 0, -1, function (err, groupNames) { @@ -402,5 +399,4 @@ module.exports = function (privileges) { }, }, callback); }; - }; diff --git a/src/privileges/posts.js b/src/privileges/posts.js index e362e27a27..a27dd51a93 100644 --- a/src/privileges/posts.js +++ b/src/privileges/posts.js @@ -11,7 +11,6 @@ var helpers = require('./helpers'); var plugins = require('../plugins'); module.exports = function (privileges) { - privileges.posts = {}; privileges.posts.get = function (pids, uid, callback) { @@ -91,7 +90,6 @@ module.exports = function (privileges) { topics.getTopicsFields(tids, ['deleted', 'cid'], next); }, function (topicData, next) { - topicData.forEach(function (topic, index) { if (topic) { tidToTopic[tids[index]] = topic; @@ -111,7 +109,6 @@ module.exports = function (privileges) { privileges.categories.getBase(privilege, cids, uid, next); }, function (results, next) { - var isModOf = {}; cids = cids.filter(function (cid, index) { isModOf[cid] = results.isModerators[index]; diff --git a/src/privileges/topics.js b/src/privileges/topics.js index abf491bdc2..16c652ceb3 100644 --- a/src/privileges/topics.js +++ b/src/privileges/topics.js @@ -12,7 +12,6 @@ var categories = require('../categories'); var plugins = require('../plugins'); module.exports = function (privileges) { - privileges.topics = {}; privileges.topics.get = function (tid, uid, callback) { @@ -93,7 +92,6 @@ module.exports = function (privileges) { privileges.categories.getBase(privilege, cids, uid, next); }, function (results, next) { - var isModOf = {}; cids = cids.filter(function (cid, index) { isModOf[cid] = results.isModerators[index]; diff --git a/src/privileges/users.js b/src/privileges/users.js index 7c4818b013..9d8d55b6f5 100644 --- a/src/privileges/users.js +++ b/src/privileges/users.js @@ -7,7 +7,6 @@ var groups = require('../groups'); var plugins = require('../plugins'); module.exports = function (privileges) { - privileges.users = {}; privileges.users.isAdministrator = function (uid, callback) { @@ -160,5 +159,4 @@ module.exports = function (privileges) { callback(null, canEdit); }); }; - }; diff --git a/src/rewards/admin.js b/src/rewards/admin.js index bd52824f94..60f335ef86 100644 --- a/src/rewards/admin.js +++ b/src/rewards/admin.js @@ -7,9 +7,7 @@ var db = require('../database'); var rewards = module.exports; rewards.save = function (data, callback) { - async.each(data, function save(data, next) { - if (!Object.keys(data.rewards).length) { return next(); } @@ -26,7 +24,6 @@ rewards.save = function (data, callback) { } }, function (rid, next) { - data.id = rid; async.series([ @@ -45,7 +42,6 @@ rewards.save = function (data, callback) { ], next); }, ], next); - }, function (err) { if (err) { return callback(err); diff --git a/src/routes/api.js b/src/routes/api.js index 92649d8fad..16ead5c588 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -5,7 +5,6 @@ var express = require('express'); var uploadsController = require('../controllers/uploads'); module.exports = function (app, middleware, controllers) { - var router = express.Router(); app.use('/api', router); @@ -36,6 +35,5 @@ module.exports = function (app, middleware, controllers) { router.post('/user/:userslug/uploadcover', middlewares.concat([middleware.authenticate, middleware.checkGlobalPrivacySettings, middleware.checkAccountPermissions]), controllers.accounts.edit.uploadCoverPicture); router.post('/groups/uploadpicture', middlewares.concat([middleware.authenticate]), controllers.groups.uploadCover); - }; diff --git a/src/routes/authentication.js b/src/routes/authentication.js index f2735ab8a9..6a3e5ef197 100644 --- a/src/routes/authentication.js +++ b/src/routes/authentication.js @@ -85,5 +85,4 @@ uid: uid, }); }); - }(exports)); diff --git a/src/routes/feeds.js b/src/routes/feeds.js index 3ee7593714..357c7dcc7d 100644 --- a/src/routes/feeds.js +++ b/src/routes/feeds.js @@ -242,7 +242,6 @@ function generateForTopics(options, set, req, res, next) { } function generateTopicsFeed(feedOptions, feedTopics, callback) { - feedOptions.ttl = 60; feedOptions.feed_url = nconf.get('url') + feedOptions.feed_url; feedOptions.site_url = nconf.get('url') + feedOptions.site_url; diff --git a/src/search.js b/src/search.js index 551685818c..82886a1d18 100644 --- a/src/search.js +++ b/src/search.js @@ -17,7 +17,6 @@ var search = {}; module.exports = search; search.search = function (data, callback) { - var start = process.hrtime(); var searchIn = data.searchIn || 'titlesposts'; @@ -253,7 +252,6 @@ function getMatchedPosts(pids, data, callback) { }, next); }, function (results, next) { - posts.forEach(function (post, index) { if (results.topics && results.topics[index]) { post.topic = results.topics[index]; diff --git a/src/socket.io/groups.js b/src/socket.io/groups.js index 33df72409a..3b27b7fdc2 100644 --- a/src/socket.io/groups.js +++ b/src/socket.io/groups.js @@ -187,7 +187,6 @@ SocketGroups.kick = isOwner(function (socket, data, callback) { } groups.kick(data.uid, data.groupName, isOwner, callback); }); - }); SocketGroups.create = function (socket, data, callback) { diff --git a/src/socket.io/posts/bookmarks.js b/src/socket.io/posts/bookmarks.js index 27d1c9570e..b77ce526a1 100644 --- a/src/socket.io/posts/bookmarks.js +++ b/src/socket.io/posts/bookmarks.js @@ -4,7 +4,6 @@ var helpers = require('./helpers'); module.exports = function (SocketPosts) { - SocketPosts.bookmark = function (socket, data, callback) { helpers.postCommand(socket, 'bookmark', 'bookmarked', '', data, callback); }; @@ -12,5 +11,4 @@ module.exports = function (SocketPosts) { SocketPosts.unbookmark = function (socket, data, callback) { helpers.postCommand(socket, 'unbookmark', 'bookmarked', '', data, callback); }; - }; diff --git a/src/socket.io/posts/edit.js b/src/socket.io/posts/edit.js index cbb613c16b..c7ca9dc1e8 100644 --- a/src/socket.io/posts/edit.js +++ b/src/socket.io/posts/edit.js @@ -11,7 +11,6 @@ var meta = require('../../meta'); var websockets = require('../index'); module.exports = function (SocketPosts) { - SocketPosts.edit = function (socket, data, callback) { if (!socket.uid) { return callback(new Error('[[error:not-logged-in]]')); diff --git a/src/socket.io/posts/flag.js b/src/socket.io/posts/flag.js index cf2e8c9fce..e5a89e778f 100644 --- a/src/socket.io/posts/flag.js +++ b/src/socket.io/posts/flag.js @@ -14,7 +14,6 @@ var meta = require('../../meta'); var utils = require('../../../public/src/utils'); module.exports = function (SocketPosts) { - SocketPosts.flag = function (socket, data, callback) { if (!socket.uid) { return callback(new Error('[[error:not-logged-in]]')); diff --git a/src/socket.io/posts/move.js b/src/socket.io/posts/move.js index 38a885a39d..6ef596c1c2 100644 --- a/src/socket.io/posts/move.js +++ b/src/socket.io/posts/move.js @@ -6,7 +6,6 @@ var topics = require('../../topics'); var socketHelpers = require('../helpers'); module.exports = function (SocketPosts) { - SocketPosts.movePost = function (socket, data, callback) { if (!socket.uid) { return callback(new Error('[[error:not-logged-in]]')); @@ -33,5 +32,4 @@ module.exports = function (SocketPosts) { }, ], callback); }; - }; diff --git a/src/socket.io/posts/tools.js b/src/socket.io/posts/tools.js index 3ef8e01020..d759a5c249 100644 --- a/src/socket.io/posts/tools.js +++ b/src/socket.io/posts/tools.js @@ -13,7 +13,6 @@ var plugins = require('../../plugins'); var social = require('../../social'); module.exports = function (SocketPosts) { - SocketPosts.loadPostTools = function (socket, data, callback) { if (!data || !data.pid || !data.cid) { return callback(new Error('[[error:invalid-data]]')); @@ -103,7 +102,6 @@ module.exports = function (SocketPosts) { posts.tools.restore(socket.uid, data.pid, next); }, function (postData, next) { - websockets.in('topic_' + data.tid).emit('event:post_restored', postData); events.log({ @@ -200,5 +198,4 @@ module.exports = function (SocketPosts) { }, }, callback); } - }; diff --git a/src/socket.io/posts/votes.js b/src/socket.io/posts/votes.js index 6e90bb2ac7..0c12fe262d 100644 --- a/src/socket.io/posts/votes.js +++ b/src/socket.io/posts/votes.js @@ -9,7 +9,6 @@ var privileges = require('../../privileges'); var helpers = require('./helpers'); module.exports = function (SocketPosts) { - SocketPosts.getVoters = function (socket, data, callback) { if (!data || !data.pid || !data.cid) { return callback(new Error('[[error:invalid-data]]')); diff --git a/src/socket.io/topics/infinitescroll.js b/src/socket.io/topics/infinitescroll.js index d1a44178a5..275fa18895 100644 --- a/src/socket.io/topics/infinitescroll.js +++ b/src/socket.io/topics/infinitescroll.js @@ -9,7 +9,6 @@ var utils = require('../../../public/src/utils'); var social = require('../../social'); module.exports = function (SocketTopics) { - SocketTopics.loadMore = function (socket, data, callback) { if (!data || !data.tid || !utils.isNumber(data.after) || parseInt(data.after, 10) < 0) { return callback(new Error('[[error:invalid-data]]')); @@ -122,5 +121,4 @@ module.exports = function (SocketTopics) { topics.getTopicsFromSet(data.set, socket.uid, start, stop, callback); }; - }; diff --git a/src/socket.io/topics/move.js b/src/socket.io/topics/move.js index 99b15a7461..9faffa910b 100644 --- a/src/socket.io/topics/move.js +++ b/src/socket.io/topics/move.js @@ -7,7 +7,6 @@ var privileges = require('../../privileges'); var socketHelpers = require('../helpers'); module.exports = function (SocketTopics) { - SocketTopics.move = function (socket, data, callback) { if (!data || !Array.isArray(data.tids) || !data.cid) { return callback(new Error('[[error:invalid-data]]')); diff --git a/src/socket.io/topics/tags.js b/src/socket.io/topics/tags.js index 0efb40b4ec..4ef579babb 100644 --- a/src/socket.io/topics/tags.js +++ b/src/socket.io/topics/tags.js @@ -6,7 +6,6 @@ var topics = require('../../topics'); var utils = require('../../../public/src/utils'); module.exports = function (SocketTopics) { - SocketTopics.isTagAllowed = function (socket, data, callback) { if (!data || !data.cid || !data.tag) { return callback(new Error('[[error:invalid-data]]')); diff --git a/src/socket.io/topics/tools.js b/src/socket.io/topics/tools.js index 7a283edbd6..8df029c926 100644 --- a/src/socket.io/topics/tools.js +++ b/src/socket.io/topics/tools.js @@ -10,7 +10,6 @@ var plugins = require('../../plugins'); var socketHelpers = require('../helpers'); module.exports = function (SocketTopics) { - SocketTopics.loadTopicTools = function (socket, data, callback) { if (!socket.uid) { return callback(new Error('[[error:no-privileges]]')); @@ -128,5 +127,4 @@ module.exports = function (SocketTopics) { topics.tools.orderPinnedTopics(socket.uid, data, callback); }; - }; diff --git a/src/socket.io/topics/unread.js b/src/socket.io/topics/unread.js index e4efb2513f..8fa5651e32 100644 --- a/src/socket.io/topics/unread.js +++ b/src/socket.io/topics/unread.js @@ -6,7 +6,6 @@ var user = require('../../user'); var topics = require('../../topics'); module.exports = function (SocketTopics) { - SocketTopics.markAsRead = function (socket, tids, callback) { if (!Array.isArray(tids) || !socket.uid) { return callback(new Error('[[error:invalid-data]]')); diff --git a/src/socket.io/user.js b/src/socket.io/user.js index 30130a5ba1..533d6e64fd 100644 --- a/src/socket.io/user.js +++ b/src/socket.io/user.js @@ -300,7 +300,6 @@ SocketUser.invite = function (socket, email, callback) { user.sendInvitationEmail(socket.uid, email, callback); } }); - }; SocketUser.getUserByUID = function (socket, uid, callback) { diff --git a/src/socket.io/user/ban.js b/src/socket.io/user/ban.js index cf869cc5de..54ce94fd24 100644 --- a/src/socket.io/user/ban.js +++ b/src/socket.io/user/ban.js @@ -8,7 +8,6 @@ var events = require('../../events'); var plugins = require('../../plugins'); module.exports = function (SocketUser) { - SocketUser.banUsers = function (socket, data, callback) { if (!data || !Array.isArray(data.uids)) { return callback(new Error('[[error:invalid-data]]')); diff --git a/src/socket.io/user/picture.js b/src/socket.io/user/picture.js index 4ddcd79f40..b0ddd8cdcd 100644 --- a/src/socket.io/user/picture.js +++ b/src/socket.io/user/picture.js @@ -9,7 +9,6 @@ var user = require('../../user'); var plugins = require('../../plugins'); module.exports = function (SocketUser) { - SocketUser.changePicture = function (socket, data, callback) { if (!socket.uid) { return callback(new Error('[[error:invalid-uid]]')); diff --git a/src/socket.io/user/profile.js b/src/socket.io/user/profile.js index 14c1593f28..e2d4de9ce1 100644 --- a/src/socket.io/user/profile.js +++ b/src/socket.io/user/profile.js @@ -8,7 +8,6 @@ var events = require('../../events'); var privileges = require('../../privileges'); module.exports = function (SocketUser) { - SocketUser.changeUsernameEmail = function (socket, data, callback) { if (!data || !data.uid || !socket.uid) { return callback(new Error('[[error:invalid-data]]')); @@ -186,6 +185,4 @@ module.exports = function (SocketUser) { }, ], callback); }; - - }; diff --git a/src/socket.io/user/search.js b/src/socket.io/user/search.js index acb857a6d8..7d51ead4cf 100644 --- a/src/socket.io/user/search.js +++ b/src/socket.io/user/search.js @@ -5,7 +5,6 @@ var meta = require('../../meta'); var pagination = require('../../pagination'); module.exports = function (SocketUser) { - SocketUser.search = function (socket, data, callback) { if (!data) { return callback(new Error('[[error:invalid-data]]')); @@ -31,5 +30,4 @@ module.exports = function (SocketUser) { callback(null, result); }); }; - }; diff --git a/src/socket.io/user/status.js b/src/socket.io/user/status.js index 37e7ac7925..562a57d82c 100644 --- a/src/socket.io/user/status.js +++ b/src/socket.io/user/status.js @@ -6,7 +6,6 @@ var user = require('../../user'); var websockets = require('../index'); module.exports = function (SocketUser) { - SocketUser.checkStatus = function (socket, uid, callback) { if (!socket.uid) { return callback(new Error('[[error:invalid-uid]]')); diff --git a/src/topics.js b/src/topics.js index 23f233d0d2..0972988bfa 100644 --- a/src/topics.js +++ b/src/topics.js @@ -13,7 +13,6 @@ var privileges = require('./privileges'); var social = require('./social'); (function (Topics) { - require('./topics/data')(Topics); require('./topics/create')(Topics); require('./topics/delete')(Topics); @@ -321,5 +320,4 @@ var social = require('./social'); callback(new Error('no-plugins-available'), []); } }; - }(exports)); diff --git a/src/topics/bookmarks.js b/src/topics/bookmarks.js index f1ed4c3ae8..487d3fd29e 100644 --- a/src/topics/bookmarks.js +++ b/src/topics/bookmarks.js @@ -7,7 +7,6 @@ var db = require('../database'); var posts = require('../posts'); module.exports = function (Topics) { - Topics.getUserBookmark = function (tid, uid, callback) { db.sortedSetScore('tid:' + tid + ':bookmarks', uid, callback); }; @@ -79,5 +78,4 @@ module.exports = function (Topics) { callback(err); }); }; - }; diff --git a/src/topics/create.js b/src/topics/create.js index 8419f56c91..2b4f022f57 100644 --- a/src/topics/create.js +++ b/src/topics/create.js @@ -15,7 +15,6 @@ var privileges = require('../privileges'); var categories = require('../categories'); module.exports = function (Topics) { - Topics.create = function (data, callback) { // This is an internal method, consider using Topics.post instead var timestamp = data.timestamp || Date.now(); @@ -356,5 +355,4 @@ module.exports = function (Topics) { } callback(); } - }; diff --git a/src/topics/data.js b/src/topics/data.js index 4758e7a085..cf1df2787c 100644 --- a/src/topics/data.js +++ b/src/topics/data.js @@ -7,7 +7,6 @@ var categories = require('../categories'); var utils = require('../../public/src/utils'); module.exports = function (Topics) { - Topics.getTopicField = function (tid, field, callback) { db.getObjectField('topic:' + tid, field, callback); }; @@ -87,5 +86,4 @@ module.exports = function (Topics) { Topics.deleteTopicField = function (tid, field, callback) { db.deleteObjectField('topic:' + tid, field, callback); }; - }; diff --git a/src/topics/delete.js b/src/topics/delete.js index 4dc1e866d2..dbf8474ecb 100644 --- a/src/topics/delete.js +++ b/src/topics/delete.js @@ -10,7 +10,6 @@ var batch = require('../batch'); module.exports = function (Topics) { - Topics.delete = function (tid, uid, callback) { Topics.getTopicFields(tid, ['cid'], function (err, topicData) { if (err) { diff --git a/src/topics/follow.js b/src/topics/follow.js index 78ef0e87cc..48742797b8 100644 --- a/src/topics/follow.js +++ b/src/topics/follow.js @@ -16,7 +16,6 @@ var emailer = require('../emailer'); var plugins = require('../plugins'); module.exports = function (Topics) { - Topics.toggleFollow = function (tid, uid, callback) { callback = callback || function () {}; var isFollowing; diff --git a/src/topics/fork.js b/src/topics/fork.js index ef62d65b1d..6a9965b51c 100644 --- a/src/topics/fork.js +++ b/src/topics/fork.js @@ -12,7 +12,6 @@ var meta = require('../meta'); module.exports = function (Topics) { - Topics.createTopicFromPosts = function (uid, title, pids, fromTid, callback) { if (title) { title = title.trim(); @@ -174,6 +173,4 @@ module.exports = function (Topics) { }, ], callback); } - - }; diff --git a/src/topics/popular.js b/src/topics/popular.js index cca04e40ba..e6d78ad4b4 100644 --- a/src/topics/popular.js +++ b/src/topics/popular.js @@ -5,7 +5,6 @@ var async = require('async'); var privileges = require('../privileges'); module.exports = function (Topics) { - Topics.getPopular = function (term, uid, count, callback) { count = parseInt(count, 10) || 20; diff --git a/src/topics/posts.js b/src/topics/posts.js index 5bcebf38ca..e013eaf7b0 100644 --- a/src/topics/posts.js +++ b/src/topics/posts.js @@ -12,7 +12,6 @@ var meta = require('../meta'); var plugins = require('../plugins'); module.exports = function (Topics) { - Topics.onNewPostMade = function (postData, callback) { async.series([ function (next) { @@ -383,5 +382,4 @@ module.exports = function (Topics) { Topics.getPostCount = function (tid, callback) { db.getObjectField('topic:' + tid, 'postcount', callback); }; - }; diff --git a/src/topics/suggested.js b/src/topics/suggested.js index e0049a15a7..d69471744f 100644 --- a/src/topics/suggested.js +++ b/src/topics/suggested.js @@ -8,7 +8,6 @@ var categories = require('../categories'); var search = require('../search'); module.exports = function (Topics) { - Topics.getSuggestedTopics = function (tid, uid, start, stop, callback) { async.parallel({ tagTids: function (next) { @@ -76,5 +75,4 @@ module.exports = function (Topics) { }, ], callback); } - }; diff --git a/src/topics/tags.js b/src/topics/tags.js index f7d1b3034c..a82a7e4890 100644 --- a/src/topics/tags.js +++ b/src/topics/tags.js @@ -11,7 +11,6 @@ var utils = require('../../public/src/utils'); module.exports = function (Topics) { - Topics.createTags = function (tags, tid, timestamp, callback) { callback = callback || function () {}; diff --git a/src/topics/teaser.js b/src/topics/teaser.js index 617f9660f1..c18b97c554 100644 --- a/src/topics/teaser.js +++ b/src/topics/teaser.js @@ -12,7 +12,6 @@ var plugins = require('../plugins'); var utils = require('../../public/src/utils'); module.exports = function (Topics) { - Topics.getTeasers = function (topics, callback) { if (!Array.isArray(topics) || !topics.length) { return callback(null, []); diff --git a/src/topics/thumb.js b/src/topics/thumb.js index 171dabb11b..8735dcc7c4 100644 --- a/src/topics/thumb.js +++ b/src/topics/thumb.js @@ -16,7 +16,6 @@ var file = require('../file'); var plugins = require('../plugins'); module.exports = function (Topics) { - Topics.resizeAndUploadThumb = function (data, callback) { if (!data.thumb || !validator.isURL(data.thumb)) { return callback(); @@ -30,7 +29,6 @@ module.exports = function (Topics) { request.head(data.thumb, next); }, function (res, body, next) { - var type = res.headers['content-type']; if (!type.match(/image./)) { return next(new Error('[[error:invalid-file]]')); @@ -87,5 +85,4 @@ module.exports = function (Topics) { }); } } - }; diff --git a/src/topics/tools.js b/src/topics/tools.js index aa877e7de7..396c4b9b3e 100644 --- a/src/topics/tools.js +++ b/src/topics/tools.js @@ -10,7 +10,6 @@ var privileges = require('../privileges'); module.exports = function (Topics) { - var topicTools = {}; Topics.tools = topicTools; @@ -324,6 +323,4 @@ module.exports = function (Topics) { }); }); }; - - }; diff --git a/src/topics/unread.js b/src/topics/unread.js index 17c5b701e0..80dfb0efeb 100644 --- a/src/topics/unread.js +++ b/src/topics/unread.js @@ -12,7 +12,6 @@ var meta = require('../meta'); var utils = require('../../public/src/utils'); module.exports = function (Topics) { - Topics.getTotalUnread = function (uid, filter, callback) { if (!callback) { callback = filter; @@ -25,7 +24,6 @@ module.exports = function (Topics) { Topics.getUnreadTopics = function (cid, uid, start, stop, filter, callback) { - var unreadTopics = { showSelect: true, nextStart: 0, @@ -141,7 +139,6 @@ module.exports = function (Topics) { } }, function (tids, next) { - tids = tids.slice(0, 200); filterTopics(uid, tids, cid, ignoredCids, filter, next); @@ -375,5 +372,4 @@ module.exports = function (Topics) { callback(null, tids); }); }; - }; diff --git a/src/topics/user.js b/src/topics/user.js index b2916a7464..2ecefb5c53 100644 --- a/src/topics/user.js +++ b/src/topics/user.js @@ -7,7 +7,6 @@ var db = require('../database'); var posts = require('../posts'); module.exports = function (Topics) { - Topics.isOwner = function (tid, uid, callback) { uid = parseInt(uid, 10); if (!uid) { diff --git a/src/user.js b/src/user.js index 13dd352b1a..17d0a59585 100644 --- a/src/user.js +++ b/src/user.js @@ -11,7 +11,6 @@ var privileges = require('./privileges'); var meta = require('./meta'); (function (User) { - User.email = require('./user/email'); User.notifications = require('./user/notifications'); User.reset = require('./user/reset'); @@ -162,7 +161,6 @@ var meta = require('./meta'); callback(null, isOnline); }); } - }; User.exists = function (uid, callback) { @@ -382,6 +380,4 @@ var meta = require('./meta'); callback(); }; - - }(exports)); diff --git a/src/user/admin.js b/src/user/admin.js index 591e1f6d2e..39a12a9c0a 100644 --- a/src/user/admin.js +++ b/src/user/admin.js @@ -8,7 +8,6 @@ var plugins = require('../plugins'); var winston = require('winston'); module.exports = function (User) { - User.logIP = function (uid, ip) { var now = Date.now(); db.sortedSetAdd('uid:' + uid + ':ip', now, ip || 'Unknown'); diff --git a/src/user/approval.js b/src/user/approval.js index 5194c26dd1..33a3d0ab8a 100644 --- a/src/user/approval.js +++ b/src/user/approval.js @@ -14,7 +14,6 @@ var utils = require('../../public/src/utils'); var plugins = require('../plugins'); module.exports = function (User) { - User.addToApprovalQueue = function (userData, callback) { userData.userslug = utils.slugify(userData.username); async.waterfall([ @@ -219,6 +218,4 @@ module.exports = function (User) { }, ], callback); }; - - }; diff --git a/src/user/auth.js b/src/user/auth.js index 968078e651..a59e68b43f 100644 --- a/src/user/auth.js +++ b/src/user/auth.js @@ -147,7 +147,6 @@ module.exports = function (User) { User.auth.deleteAllSessions = function (callback) { var _ = require('underscore'); batch.processSortedSet('users:joindate', function (uids, next) { - var sessionKeys = uids.map(function (uid) { return 'uid:' + uid + ':sessions'; }); diff --git a/src/user/categories.js b/src/user/categories.js index 4188fecf72..8a4b26199f 100644 --- a/src/user/categories.js +++ b/src/user/categories.js @@ -6,7 +6,6 @@ var db = require('../database'); var categories = require('../categories'); module.exports = function (User) { - User.getIgnoredCategories = function (uid, callback) { db.getSortedSetRange('uid:' + uid + ':ignored:cids', 0, -1, callback); }; diff --git a/src/user/create.js b/src/user/create.js index 4bd6ddcaa4..20af1dd20a 100644 --- a/src/user/create.js +++ b/src/user/create.js @@ -9,7 +9,6 @@ var groups = require('../groups'); var meta = require('../meta'); module.exports = function (User) { - User.create = function (data, callback) { data.username = data.username.trim(); data.userslug = utils.slugify(data.username); @@ -225,5 +224,4 @@ module.exports = function (User) { }); }); } - }; diff --git a/src/user/data.js b/src/user/data.js index a303080e9c..5812180df5 100644 --- a/src/user/data.js +++ b/src/user/data.js @@ -9,7 +9,6 @@ var plugins = require('../plugins'); var utils = require('../../public/src/utils'); module.exports = function (User) { - var iconBackgrounds = ['#f44336', '#e91e63', '#9c27b0', '#673ab7', '#3f51b5', '#2196f3', '#009688', '#1b5e20', '#33691e', '#827717', '#e65100', '#ff5722', '#795548', '#607d8b']; @@ -199,5 +198,4 @@ module.exports = function (User) { callback(null, value); }); }; - }; diff --git a/src/user/delete.js b/src/user/delete.js index ba3b56695d..28b8a4989e 100644 --- a/src/user/delete.js +++ b/src/user/delete.js @@ -10,7 +10,6 @@ var plugins = require('../plugins'); var batch = require('../batch'); module.exports = function (User) { - User.delete = function (callerUid, uid, callback) { if (!parseInt(uid, 10)) { return callback(new Error('[[error:invalid-uid]]')); diff --git a/src/user/digest.js b/src/user/digest.js index 76463caab4..73cd773713 100644 --- a/src/user/digest.js +++ b/src/user/digest.js @@ -129,5 +129,4 @@ var utils = require('../../public/src/utils'); callback(err); }); }; - }(module.exports)); diff --git a/src/user/email.js b/src/user/email.js index 2e51da951a..5e124551bd 100644 --- a/src/user/email.js +++ b/src/user/email.js @@ -13,7 +13,6 @@ var meta = require('../meta'); var emailer = require('../emailer'); (function (UserEmail) { - UserEmail.exists = function (email, callback) { user.getUidByEmail(email.toLowerCase(), function (err, exists) { callback(err, !!exists); @@ -112,5 +111,4 @@ var emailer = require('../emailer'); } }); }; - }(exports)); diff --git a/src/user/follow.js b/src/user/follow.js index fb8033ec80..fe3dc0931d 100644 --- a/src/user/follow.js +++ b/src/user/follow.js @@ -6,7 +6,6 @@ var plugins = require('../plugins'); var db = require('../database'); module.exports = function (User) { - User.follow = function (uid, followuid, callback) { toggleFollow('follow', uid, followuid, callback); }; @@ -97,5 +96,4 @@ module.exports = function (User) { } db.isSortedSetMember('following:' + uid, theirid, callback); }; - }; diff --git a/src/user/invite.js b/src/user/invite.js index 30c3091ade..25cadc41bf 100644 --- a/src/user/invite.js +++ b/src/user/invite.js @@ -12,7 +12,6 @@ var utils = require('../../public/src/utils'); module.exports = function (User) { - User.getInvites = function (uid, callback) { db.getSetMembers('invitation:uid:' + uid, callback); }; @@ -148,5 +147,4 @@ module.exports = function (User) { callback = callback || function () {}; db.delete('invitation:email:' + email, callback); }; - }; diff --git a/src/user/jobs.js b/src/user/jobs.js index 591dba16fd..1eeeb5650e 100644 --- a/src/user/jobs.js +++ b/src/user/jobs.js @@ -62,8 +62,6 @@ module.exports = function (User) { if (typeof callback === 'function') { callback(); } - - }; }; diff --git a/src/user/notifications.js b/src/user/notifications.js index cc8d8b6ec1..93f9d2e124 100644 --- a/src/user/notifications.js +++ b/src/user/notifications.js @@ -11,7 +11,6 @@ var notifications = require('../notifications'); var privileges = require('../privileges'); (function (UserNotifications) { - UserNotifications.get = function (uid, callback) { if (!parseInt(uid, 10)) { return callback(null, {read: [], unread: []}); @@ -287,5 +286,4 @@ var privileges = require('../privileges'); websockets.in('uid_' + uid).emit('event:notifications.updateCount', count); }); }; - }(exports)); diff --git a/src/user/password.js b/src/user/password.js index aaad4c2563..6cf5d8e5d5 100644 --- a/src/user/password.js +++ b/src/user/password.js @@ -7,7 +7,6 @@ var db = require('../database'); var Password = require('../password'); module.exports = function (User) { - User.hashPassword = function (password, callback) { if (!password) { return callback(null, password); @@ -43,5 +42,4 @@ module.exports = function (User) { callback(err, !!hashedPassword); }); }; - }; diff --git a/src/user/picture.js b/src/user/picture.js index acea101294..08b548e444 100644 --- a/src/user/picture.js +++ b/src/user/picture.js @@ -17,9 +17,7 @@ var meta = require('../meta'); var db = require('../database'); module.exports = function (User) { - User.uploadPicture = function (uid, picture, callback) { - var uploadSize = parseInt(meta.config.maximumProfileImageSize, 10) || 256; var extension = path.extname(picture.name); var updateUid = uid; diff --git a/src/user/posts.js b/src/user/posts.js index 1747c803a0..3f2d608ee1 100644 --- a/src/user/posts.js +++ b/src/user/posts.js @@ -6,7 +6,6 @@ var meta = require('../meta'); var privileges = require('../privileges'); module.exports = function (User) { - User.isReadyToPost = function (uid, cid, callback) { if (parseInt(uid, 10) === 0) { return callback(); @@ -101,5 +100,4 @@ module.exports = function (User) { callback(err, Array.isArray(pids) ? pids : []); }); }; - }; diff --git a/src/user/profile.js b/src/user/profile.js index 1987bf1ae4..ea813db035 100644 --- a/src/user/profile.js +++ b/src/user/profile.js @@ -11,7 +11,6 @@ var groups = require('../groups'); var plugins = require('../plugins'); module.exports = function (User) { - User.updateProfile = function (uid, data, callback) { var fields = ['username', 'email', 'fullname', 'website', 'location', 'groupTitle', 'birthday', 'signature', 'aboutme']; diff --git a/src/user/reset.js b/src/user/reset.js index 90aa9f072e..ba0e18b513 100644 --- a/src/user/reset.js +++ b/src/user/reset.js @@ -165,5 +165,4 @@ var emailer = require('../emailer'); }, ], callback); }; - }(exports)); diff --git a/src/user/search.js b/src/user/search.js index a567b73ed6..751bb04cf2 100644 --- a/src/user/search.js +++ b/src/user/search.js @@ -7,7 +7,6 @@ var plugins = require('../plugins'); var db = require('../database'); module.exports = function (User) { - User.search = function (data, callback) { var query = data.query || ''; var searchBy = data.searchBy || 'username'; diff --git a/src/user/settings.js b/src/user/settings.js index 5868e1f45c..46eb7ada3f 100644 --- a/src/user/settings.js +++ b/src/user/settings.js @@ -7,7 +7,6 @@ var db = require('../database'); var plugins = require('../plugins'); module.exports = function (User) { - User.getSettings = function (uid, callback) { if (!parseInt(uid, 10)) { return onSettingsLoaded(0, {}, callback); diff --git a/src/user/topics.js b/src/user/topics.js index fa3cea209b..bd69e66e6f 100644 --- a/src/user/topics.js +++ b/src/user/topics.js @@ -4,7 +4,6 @@ var async = require('async'); var db = require('../database'); module.exports = function (User) { - User.getIgnoredTids = function (uid, start, stop, callback) { db.getSortedSetRevRange('uid:' + uid + ':ignored_tids', start, stop, callback); }; @@ -15,5 +14,4 @@ module.exports = function (User) { async.apply(User.incrementUserFieldBy, uid, 'topiccount', 1), ], callback); }; - }; diff --git a/test/authentication.js b/test/authentication.js index e475f1c395..3c7f58f7ac 100644 --- a/test/authentication.js +++ b/test/authentication.js @@ -145,13 +145,11 @@ describe('authentication', function () { }); }); }); - }); after(function (done) { db.emptydb(done); }); - }); diff --git a/test/build.js b/test/build.js index 404176d3df..8422887762 100644 --- a/test/build.js +++ b/test/build.js @@ -5,7 +5,6 @@ var assert = require('assert'); var db = require('./mocks/databasemock'); describe('Build', function () { - it('should build all assets', function (done) { var build = require('../src/meta/build'); build.buildAll(function (err) { diff --git a/test/categories.js b/test/categories.js index a2b699f7c1..b183a3accd 100644 --- a/test/categories.js +++ b/test/categories.js @@ -37,7 +37,6 @@ describe('Categories', function () { it('should create a new category', function (done) { - Categories.create({ name: 'Test Category', description: 'Test category created by testing script', @@ -385,7 +384,6 @@ describe('Categories', function () { done(); }); }); - }); }); diff --git a/test/controllers-admin.js b/test/controllers-admin.js index 4102446f96..e6edb82a18 100644 --- a/test/controllers-admin.js +++ b/test/controllers-admin.js @@ -13,7 +13,6 @@ var groups = require('../src/groups'); var helpers = require('./helpers'); describe('Admin Controllers', function () { - var tid; var cid; var pid; diff --git a/test/controllers.js b/test/controllers.js index 057e20b2a0..73c8a2723b 100644 --- a/test/controllers.js +++ b/test/controllers.js @@ -13,7 +13,6 @@ var meta = require('../src/meta'); describe('Controllers', function () { - var tid; var cid; var pid; @@ -674,7 +673,6 @@ describe('Controllers', function () { describe('maintenance mode', function () { - before(function (done) { meta.config.maintenanceMode = 1; done(); diff --git a/test/database.js b/test/database.js index d2f51c907e..f55bf78edb 100644 --- a/test/database.js +++ b/test/database.js @@ -25,5 +25,4 @@ describe('Test database', function () { require('./database/sets'); require('./database/hash'); require('./database/sorted'); - }); diff --git a/test/database/keys.js b/test/database/keys.js index f4b577f038..157cc2ca97 100644 --- a/test/database/keys.js +++ b/test/database/keys.js @@ -6,7 +6,6 @@ var assert = require('assert'); var db = require('../mocks/databasemock'); describe('Key methods', function () { - beforeEach(function (done) { db.set('testKey', 'testValue', done); }); diff --git a/test/database/list.js b/test/database/list.js index d328191e7a..8475ad2f52 100644 --- a/test/database/list.js +++ b/test/database/list.js @@ -6,7 +6,6 @@ var assert = require('assert'); var db = require('../mocks/databasemock'); describe('List methods', function () { - describe('listAppend()', function () { it('should append to a list', function (done) { db.listAppend('testList1', 5, function (err) { diff --git a/test/database/sets.js b/test/database/sets.js index 594af8d061..a3e79df81c 100644 --- a/test/database/sets.js +++ b/test/database/sets.js @@ -6,7 +6,6 @@ var assert = require('assert'); var db = require('../mocks/databasemock'); describe('Set methods', function () { - describe('setAdd()', function () { it('should add to a set', function (done) { db.setAdd('testSet1', 5, function (err) { diff --git a/test/database/sorted.js b/test/database/sorted.js index 25830671d6..0bd0ab31dc 100644 --- a/test/database/sorted.js +++ b/test/database/sorted.js @@ -6,7 +6,6 @@ var assert = require('assert'); var db = require('../mocks/databasemock'); describe('Sorted Set methods', function () { - before(function (done) { async.parallel([ function (next) { @@ -659,7 +658,6 @@ describe('Sorted Set methods', function () { done(); }); }); - }); describe('sortedSetIntersectCard', function () { diff --git a/test/groups.js b/test/groups.js index 1428c4e6ef..426b5c42ca 100644 --- a/test/groups.js +++ b/test/groups.js @@ -157,7 +157,6 @@ describe('Groups', function () { done(); }); }); - }); describe('.isMember()', function () { @@ -579,7 +578,6 @@ describe('Groups', function () { }); }); }); - }); describe('admin socket methods', function () { diff --git a/test/helpers/index.js b/test/helpers/index.js index cc4460ffbe..0edb10a4a0 100644 --- a/test/helpers/index.js +++ b/test/helpers/index.js @@ -144,7 +144,6 @@ helpers.registerUser = function (data, callback) { // http://stackoverflow.com/a/14387791/583363 helpers.copyFile = function (source, target, callback) { - var cbCalled = false; var rd = fs.createReadStream(source); diff --git a/test/messaging.js b/test/messaging.js index a31c89b624..76c05b3a1f 100644 --- a/test/messaging.js +++ b/test/messaging.js @@ -227,7 +227,6 @@ describe('Messaging Library', function () { done(); }); }); - }); describe('logged in chat controller', function () { diff --git a/test/meta.js b/test/meta.js index 1854cf3b53..5d9284030c 100644 --- a/test/meta.js +++ b/test/meta.js @@ -91,7 +91,6 @@ describe('meta', function () { }); }); }); - }); @@ -179,7 +178,6 @@ describe('meta', function () { }); }); }); - }); diff --git a/test/mocks/databasemock.js b/test/mocks/databasemock.js index 20eee3b5b9..4c75cb59ff 100644 --- a/test/mocks/databasemock.js +++ b/test/mocks/databasemock.js @@ -175,5 +175,4 @@ } module.exports = db; - }(module)); diff --git a/test/pagination.js b/test/pagination.js index df362d9df4..8ca2cdf586 100644 --- a/test/pagination.js +++ b/test/pagination.js @@ -5,7 +5,6 @@ var assert = require('assert'); var pagination = require('../src/pagination'); describe('Pagination', function () { - it('should create empty pagination for 1 page', function (done) { var data = pagination.create(1, 1); assert.equal(data.pages.length, 0); diff --git a/test/plugins.js b/test/plugins.js index 1df1c49f09..a9936ba819 100644 --- a/test/plugins.js +++ b/test/plugins.js @@ -10,7 +10,6 @@ var db = require('./mocks/databasemock'); var plugins = require('../src/plugins'); describe('Plugins', function () { - it('should load plugin data', function (done) { var pluginId = 'nodebb-plugin-markdown'; plugins.loadPlugin(path.join(nconf.get('base_dir'), 'node_modules/' + pluginId), function (err) { @@ -46,7 +45,6 @@ describe('Plugins', function () { assert.equal(data.foo, 7); done(); }); - }); it('should register and fire an action hook', function (done) { @@ -179,7 +177,5 @@ describe('Plugins', function () { }); }); }); - - }); diff --git a/test/posts.js b/test/posts.js index 5b0687ca5e..646182fdeb 100644 --- a/test/posts.js +++ b/test/posts.js @@ -278,7 +278,6 @@ describe('Post\'s', function () { }); it('should purge posts and delete topic', function (done) { - createTopicWithReply(function (topicPostData, replyData) { socketPosts.purgePosts({uid: voterUid}, {pids: [replyData.pid, topicPostData.postData.pid], tid: topicPostData.topicData.tid}, function (err) { assert.ifError(err); diff --git a/test/rewards.js b/test/rewards.js index 7d61398d29..8eabf6d4e2 100644 --- a/test/rewards.js +++ b/test/rewards.js @@ -72,7 +72,6 @@ describe('rewards', function () { done(); }); }); - }); diff --git a/test/search.js b/test/search.js index 12287c93e4..e6b5c6d9cb 100644 --- a/test/search.js +++ b/test/search.js @@ -95,7 +95,6 @@ describe('Search', function () { }); it('should search term in titles and posts', function (done) { - var meta = require('../src/meta'); meta.config.allowGuestSearching = 1; var qs = '/api/search?term=cucumber&in=titlesposts&categories[]=' + cid1 + '&by=phoebe&replies=1&repliesFilter=atleast&sortBy=timestamp&sortDirection=desc&showAs=posts'; diff --git a/test/socket.io.js b/test/socket.io.js index 0671354bcc..f5de533401 100644 --- a/test/socket.io.js +++ b/test/socket.io.js @@ -19,7 +19,6 @@ var categories = require('../src/categories'); describe('socket.io', function () { - var io; var cid; var tid; @@ -435,6 +434,5 @@ describe('socket.io', function () { after(function (done) { db.emptydb(done); }); - }); diff --git a/test/topics.js b/test/topics.js index 91577cfa3d..ad48e4cc7f 100644 --- a/test/topics.js +++ b/test/topics.js @@ -48,7 +48,6 @@ describe('Topic\'s', function () { }); describe('.post', function () { - it('should create a new topic with proper parameters', function (done) { topics.post({uid: topic.userId, title: topic.title, content: topic.content, cid: topic.categoryId}, function (err, result) { assert.equal(err, null, 'was created with error'); @@ -205,7 +204,6 @@ describe('Topic\'s', function () { }); describe('Title escaping', function () { - it('should properly escape topic title', function (done) { var title = '" new topic test'; var titleEscaped = validator.escape(title); @@ -448,7 +446,6 @@ describe('Topic\'s', function () { }); }); }); - }); @@ -749,7 +746,6 @@ describe('Topic\'s', function () { done(); }); }); - }); describe('suggested topics', function () { diff --git a/test/uploads.js b/test/uploads.js index 066a20434f..328e29ae94 100644 --- a/test/uploads.js +++ b/test/uploads.js @@ -16,7 +16,6 @@ var helpers = require('./helpers'); describe('Upload Controllers', function () { - var tid; var cid; var pid; @@ -100,7 +99,6 @@ describe('Upload Controllers', function () { done(); }); }); - }); diff --git a/test/user.js b/test/user.js index 9db04d8a74..5573cbe400 100644 --- a/test/user.js +++ b/test/user.js @@ -22,7 +22,6 @@ describe('User', function () { var testCid; before(function (done) { - groups.resetCache(); Categories.create({ @@ -292,7 +291,6 @@ describe('User', function () { }); describe('hash methods', function () { - it('should return uid from email', function (done) { User.getUidByEmail('john@example.com', function (err, uid) { assert.ifError(err); @@ -686,7 +684,6 @@ describe('User', function () { }); }); }); - }); }); @@ -903,7 +900,6 @@ describe('User', function () { }); }); }); - }); }); @@ -978,7 +974,6 @@ describe('User', function () { }); }); }); - }); diff --git a/test/utils.js b/test/utils.js index 96ccdce201..547a673aee 100644 --- a/test/utils.js +++ b/test/utils.js @@ -171,5 +171,4 @@ describe('Utility Methods', function () { } done(); }); - });