mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-17 19:21:04 +01:00
This commit is contained in:
@@ -4,6 +4,7 @@ var async = require('async');
|
||||
|
||||
var meta = require('../../meta');
|
||||
var emailer = require('../../emailer');
|
||||
var plugins = require('../../plugins');
|
||||
|
||||
var settingsController = module.exports;
|
||||
|
||||
@@ -14,7 +15,9 @@ settingsController.get = function (req, res, next) {
|
||||
case 'email':
|
||||
renderEmail(req, res, next);
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
renderUser(req, res, next);
|
||||
break;
|
||||
default:
|
||||
res.render('admin/settings/' + term);
|
||||
}
|
||||
@@ -22,20 +25,53 @@ settingsController.get = function (req, res, next) {
|
||||
|
||||
|
||||
function renderEmail(req, res, next) {
|
||||
async.parallel({
|
||||
emails: async.apply(emailer.getTemplates, meta.config),
|
||||
services: emailer.listServices,
|
||||
}, function (err, results) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
res.render('admin/settings/email', {
|
||||
emails: results.emails,
|
||||
sendable: results.emails.filter(function (email) {
|
||||
return email.path.indexOf('_plaintext') === -1 && email.path.indexOf('partials') === -1;
|
||||
}),
|
||||
services: results.services,
|
||||
});
|
||||
});
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
async.parallel({
|
||||
emails: async.apply(emailer.getTemplates, meta.config),
|
||||
services: emailer.listServices,
|
||||
}, next);
|
||||
},
|
||||
function (results) {
|
||||
res.render('admin/settings/email', {
|
||||
emails: results.emails,
|
||||
sendable: results.emails.filter(function (email) {
|
||||
return email.path.indexOf('_plaintext') === -1 && email.path.indexOf('partials') === -1;
|
||||
}),
|
||||
services: results.services,
|
||||
});
|
||||
},
|
||||
], next);
|
||||
}
|
||||
|
||||
function renderUser(req, res, next) {
|
||||
var types = [
|
||||
'notificationType_upvote',
|
||||
'notificationType_new-topic',
|
||||
'notificationType_new-reply',
|
||||
'notificationType_follow',
|
||||
'notificationType_new-chat',
|
||||
'notificationType_group-invite',
|
||||
];
|
||||
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
plugins.fireHook('filter:user.notificationTypes', {
|
||||
userData: {},
|
||||
types: types,
|
||||
privilegedTypes: [],
|
||||
}, next);
|
||||
},
|
||||
function (results) {
|
||||
var notificationSettings = results.types.map(function modifyType(type) {
|
||||
return {
|
||||
name: type,
|
||||
label: '[[notifications:' + type + ']]',
|
||||
};
|
||||
});
|
||||
res.render('admin/settings/user', {
|
||||
notificationSettings: notificationSettings,
|
||||
});
|
||||
},
|
||||
], next);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user