Merge branch 'master' of github.com:designcreateplay/NodeBB

v1.18.x
Julian Lam 11 years ago
commit 4da1a2da97

@ -1,3 +1,6 @@
"use strict";
/*global define, socket, app, bootbox, tabIndent, config, RELATIVE_PATH*/
define(['forum/admin/settings'], function(Settings) { define(['forum/admin/settings'], function(Settings) {
var Themes = {}; var Themes = {};
@ -266,10 +269,10 @@ define(['forum/admin/settings'], function(Settings) {
for (var i in area.data) { for (var i in area.data) {
if (area.data.hasOwnProperty(i)) { if (area.data.hasOwnProperty(i)) {
var data = area.data[i], var widgetData = area.data[i],
widgetEl = $('.available-widgets [data-widget="' + data.widget + '"]').clone(); widgetEl = $('.available-widgets [data-widget="' + widgetData.widget + '"]').clone();
widgetArea.append(populateWidget(widgetEl, data.data)); widgetArea.append(populateWidget(widgetEl, widgetData.data));
appendToggle(widgetEl); appendToggle(widgetEl);
} }
} }

@ -1,3 +1,5 @@
'use strict';
var async = require('async'), var async = require('async'),
winston = require('winston'), winston = require('winston'),
cron = require('cron').CronJob, cron = require('cron').CronJob,
@ -8,7 +10,6 @@ var async = require('async'),
User = require('./user'); User = require('./user');
(function(Notifications) { (function(Notifications) {
"use strict";
Notifications.init = function() { Notifications.init = function() {
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
@ -249,10 +250,10 @@ var async = require('async'),
async.each(expiredNids, function(nid, next) { async.each(expiredNids, function(nid, next) {
async.parallel([ async.parallel([
function(next) { function(next) {
db.setRemove('notifications', nid, next) db.setRemove('notifications', nid, next);
}, },
function(next) { function(next) {
db.delete('notifications:' + nid, next) db.delete('notifications:' + nid, next);
} }
], function(err) { ], function(err) {
numPruned++; numPruned++;

@ -12,12 +12,8 @@ var nconf = require('nconf'),
pluginRoutes = require('./plugins'); pluginRoutes = require('./plugins');
/**
* Every view has an associated API route.
*
*/
function mainRoutes(app, middleware, controllers) { function mainRoutes(app, middleware, controllers) {
/* Main */
app.get('/', middleware.buildHeader, controllers.home); app.get('/', middleware.buildHeader, controllers.home);
app.get('/api/home', controllers.home); app.get('/api/home', controllers.home);
@ -38,8 +34,9 @@ function mainRoutes(app, middleware, controllers) {
app.get('/reset/:code?', middleware.buildHeader, controllers.reset); app.get('/reset/:code?', middleware.buildHeader, controllers.reset);
app.get('/api/reset/:code?', controllers.reset); app.get('/api/reset/:code?', controllers.reset);
}
/* Static Pages */ function staticRoutes(app, middleware, controllers) {
app.get('/404', middleware.buildHeader, controllers.static['404']); app.get('/404', middleware.buildHeader, controllers.static['404']);
app.get('/api/404', controllers.static['404']); app.get('/api/404', controllers.static['404']);
@ -48,12 +45,14 @@ function mainRoutes(app, middleware, controllers) {
app.get('/500', middleware.buildHeader, controllers.static['500']); app.get('/500', middleware.buildHeader, controllers.static['500']);
app.get('/api/500', controllers.static['500']); app.get('/api/500', controllers.static['500']);
}
/* Topics */ function topicRoutes(app, middleware, controllers) {
app.get('/topic/:topic_id/:slug?', middleware.buildHeader, controllers.topics.get); app.get('/topic/:topic_id/:slug?', middleware.buildHeader, controllers.topics.get);
app.get('/api/topic/:topic_id/:slug?', controllers.topics.get); app.get('/api/topic/:topic_id/:slug?', controllers.topics.get);
}
/* Categories */ function categoryRoutes(app, middleware, controllers) {
app.get('/popular/:set?', middleware.buildHeader, controllers.categories.popular); app.get('/popular/:set?', middleware.buildHeader, controllers.categories.popular);
app.get('/api/popular/:set?', controllers.categories.popular); app.get('/api/popular/:set?', controllers.categories.popular);
@ -68,8 +67,9 @@ function mainRoutes(app, middleware, controllers) {
app.get('/category/:category_id/:slug?', middleware.buildHeader, controllers.categories.get); app.get('/category/:category_id/:slug?', middleware.buildHeader, controllers.categories.get);
app.get('/api/category/:category_id/:slug?', controllers.categories.get); app.get('/api/category/:category_id/:slug?', controllers.categories.get);
}
/* Accounts */ function accountRoutes(app, middleware, controllers) {
app.get('/user/:userslug', middleware.buildHeader, middleware.checkGlobalPrivacySettings, controllers.accounts.getAccount); app.get('/user/:userslug', middleware.buildHeader, middleware.checkGlobalPrivacySettings, controllers.accounts.getAccount);
app.get('/api/user/:userslug', middleware.checkGlobalPrivacySettings, controllers.accounts.getAccount); app.get('/api/user/:userslug', middleware.checkGlobalPrivacySettings, controllers.accounts.getAccount);
@ -94,8 +94,9 @@ function mainRoutes(app, middleware, controllers) {
app.get('/notifications', middleware.buildHeader, middleware.authenticate, controllers.accounts.getNotifications); app.get('/notifications', middleware.buildHeader, middleware.authenticate, controllers.accounts.getNotifications);
app.get('/api/notifications', middleware.authenticate, controllers.accounts.getNotifications); app.get('/api/notifications', middleware.authenticate, controllers.accounts.getNotifications);
}
/* Users */ function userRoutes(app, middleware, controllers) {
app.get('/users', middleware.buildHeader, middleware.checkGlobalPrivacySettings, controllers.users.getOnlineUsers); app.get('/users', middleware.buildHeader, middleware.checkGlobalPrivacySettings, controllers.users.getOnlineUsers);
app.get('/api/users', middleware.checkGlobalPrivacySettings, controllers.users.getOnlineUsers); app.get('/api/users', middleware.checkGlobalPrivacySettings, controllers.users.getOnlineUsers);
@ -128,7 +129,18 @@ module.exports = function(app, middleware) {
apiRoutes(app, middleware, controllers); apiRoutes(app, middleware, controllers);
feedRoutes(app, middleware, controllers); feedRoutes(app, middleware, controllers);
pluginRoutes(app, middleware, controllers); pluginRoutes(app, middleware, controllers);
/**
* Every view has an associated API route.
*
*/
mainRoutes(app, middleware, controllers); mainRoutes(app, middleware, controllers);
staticRoutes(app, middleware, controllers);
topicRoutes(app, middleware, controllers);
categoryRoutes(app, middleware, controllers);
accountRoutes(app, middleware, controllers);
userRoutes(app, middleware, controllers);
}); });
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {

Loading…
Cancel
Save