From edeb22fcdfb872ed6dae334a258e84db58cb90c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sat, 20 May 2017 20:02:53 -0400 Subject: [PATCH] change style of meta.js --- src/meta.js | 118 ++++++++++++++++++++++++++-------------------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/src/meta.js b/src/meta.js index 1fb0170297..59c3447cf4 100644 --- a/src/meta.js +++ b/src/meta.js @@ -8,71 +8,71 @@ var nconf = require('nconf'); var pubsub = require('./pubsub'); var utils = require('./utils'); -(function (Meta) { - Meta.reloadRequired = false; +var Meta = module.exports; - require('./meta/configs')(Meta); - require('./meta/themes')(Meta); - require('./meta/js')(Meta); - require('./meta/css')(Meta); - require('./meta/sounds')(Meta); - require('./meta/settings')(Meta); - require('./meta/logs')(Meta); - require('./meta/errors')(Meta); - require('./meta/tags')(Meta); - require('./meta/dependencies')(Meta); - Meta.templates = require('./meta/templates'); - Meta.blacklist = require('./meta/blacklist'); - Meta.languages = require('./meta/languages'); +Meta.reloadRequired = false; - /* Assorted */ - Meta.userOrGroupExists = function (slug, callback) { - var user = require('./user'); - var groups = require('./groups'); - slug = utils.slugify(slug); - async.parallel([ - async.apply(user.existsBySlug, slug), - async.apply(groups.existsBySlug, slug), - ], function (err, results) { - callback(err, results ? results.some(function (result) { return result; }) : false); - }); - }; +require('./meta/configs')(Meta); +require('./meta/themes')(Meta); +require('./meta/js')(Meta); +require('./meta/css')(Meta); +require('./meta/sounds')(Meta); +require('./meta/settings')(Meta); +require('./meta/logs')(Meta); +require('./meta/errors')(Meta); +require('./meta/tags')(Meta); +require('./meta/dependencies')(Meta); +Meta.templates = require('./meta/templates'); +Meta.blacklist = require('./meta/blacklist'); +Meta.languages = require('./meta/languages'); - /** - * Reload deprecated as of v1.1.2+, remove in v2.x - */ - Meta.reload = function (callback) { - restart(); - callback(); - }; +/* Assorted */ +Meta.userOrGroupExists = function (slug, callback) { + var user = require('./user'); + var groups = require('./groups'); + slug = utils.slugify(slug); + async.parallel([ + async.apply(user.existsBySlug, slug), + async.apply(groups.existsBySlug, slug), + ], function (err, results) { + callback(err, results ? results.some(function (result) { return result; }) : false); + }); +}; - Meta.restart = function () { - pubsub.publish('meta:restart', { hostname: os.hostname() }); - restart(); - }; +/** + * Reload deprecated as of v1.1.2+, remove in v2.x + */ +Meta.reload = function (callback) { + restart(); + callback(); +}; - Meta.getSessionTTLSeconds = function () { - var ttlDays = 60 * 60 * 24 * (parseInt(Meta.config.loginDays, 10) || 0); - var ttlSeconds = (parseInt(Meta.config.loginSeconds, 10) || 0); - var ttl = ttlSeconds || ttlDays || 1209600; // Default to 14 days - return ttl; - }; +Meta.restart = function () { + pubsub.publish('meta:restart', { hostname: os.hostname() }); + restart(); +}; - if (nconf.get('isPrimary') === 'true') { - pubsub.on('meta:restart', function (data) { - if (data.hostname !== os.hostname()) { - restart(); - } - }); - } +Meta.getSessionTTLSeconds = function () { + var ttlDays = 60 * 60 * 24 * (parseInt(Meta.config.loginDays, 10) || 0); + var ttlSeconds = (parseInt(Meta.config.loginSeconds, 10) || 0); + var ttl = ttlSeconds || ttlDays || 1209600; // Default to 14 days + return ttl; +}; - function restart() { - if (process.send) { - process.send({ - action: 'restart', - }); - } else { - winston.error('[meta.restart] Could not restart, are you sure NodeBB was started with `./nodebb start`?'); +if (nconf.get('isPrimary') === 'true') { + pubsub.on('meta:restart', function (data) { + if (data.hostname !== os.hostname()) { + restart(); } + }); +} + +function restart() { + if (process.send) { + process.send({ + action: 'restart', + }); + } else { + winston.error('[meta.restart] Could not restart, are you sure NodeBB was started with `./nodebb start`?'); } -}(exports)); +}