mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-18 03:31:03 +01:00
This commit is contained in:
@@ -45,5 +45,6 @@
|
|||||||
"notificationType_new-reply": "notification",
|
"notificationType_new-reply": "notification",
|
||||||
"notificationType_follow": "notification",
|
"notificationType_follow": "notification",
|
||||||
"notificationType_new-chat": "notification",
|
"notificationType_new-chat": "notification",
|
||||||
"notificationType_group-invite": "notification"
|
"notificationType_group-invite": "notification",
|
||||||
|
"notificationType_mention": "notification"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ var async = require('async');
|
|||||||
|
|
||||||
var meta = require('../../meta');
|
var meta = require('../../meta');
|
||||||
var emailer = require('../../emailer');
|
var emailer = require('../../emailer');
|
||||||
|
var plugins = require('../../plugins');
|
||||||
|
|
||||||
var settingsController = module.exports;
|
var settingsController = module.exports;
|
||||||
|
|
||||||
@@ -14,7 +15,9 @@ settingsController.get = function (req, res, next) {
|
|||||||
case 'email':
|
case 'email':
|
||||||
renderEmail(req, res, next);
|
renderEmail(req, res, next);
|
||||||
break;
|
break;
|
||||||
|
case 'user':
|
||||||
|
renderUser(req, res, next);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
res.render('admin/settings/' + term);
|
res.render('admin/settings/' + term);
|
||||||
}
|
}
|
||||||
@@ -22,20 +25,53 @@ settingsController.get = function (req, res, next) {
|
|||||||
|
|
||||||
|
|
||||||
function renderEmail(req, res, next) {
|
function renderEmail(req, res, next) {
|
||||||
async.parallel({
|
async.waterfall([
|
||||||
emails: async.apply(emailer.getTemplates, meta.config),
|
function (next) {
|
||||||
services: emailer.listServices,
|
async.parallel({
|
||||||
}, function (err, results) {
|
emails: async.apply(emailer.getTemplates, meta.config),
|
||||||
if (err) {
|
services: emailer.listServices,
|
||||||
return next(err);
|
}, next);
|
||||||
}
|
},
|
||||||
|
function (results) {
|
||||||
res.render('admin/settings/email', {
|
res.render('admin/settings/email', {
|
||||||
emails: results.emails,
|
emails: results.emails,
|
||||||
sendable: results.emails.filter(function (email) {
|
sendable: results.emails.filter(function (email) {
|
||||||
return email.path.indexOf('_plaintext') === -1 && email.path.indexOf('partials') === -1;
|
return email.path.indexOf('_plaintext') === -1 && email.path.indexOf('partials') === -1;
|
||||||
}),
|
}),
|
||||||
services: results.services,
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -292,77 +292,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label>[[admin/settings/user:default-notification-settings]]</label>
|
<label>[[admin/settings/user:default-notification-settings]]</label>
|
||||||
|
|
||||||
|
<!-- BEGIN notificationSettings -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-xs-7">
|
<div class="form-group col-xs-7">
|
||||||
<label>[[notifications:notificationType_upvote]]</label>
|
<label>{notificationSettings.label}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-xs-5">
|
<div class="form-group col-xs-5">
|
||||||
<select class="form-control" data-field="notificationType_upvote">
|
<select class="form-control" data-field="{notificationSettings.name}">
|
||||||
<option value="none">[[notifications:none]]</option>
|
|
||||||
<option value="notification">[[notifications:notification_only]]</option>
|
|
||||||
<option value="email">[[notifications:email_only]]</option>
|
|
||||||
<option value="notificationemail">[[notifications:notification_and_email]]</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-xs-7">
|
|
||||||
<label>[[notifications:notificationType_new-topic]]</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-xs-5">
|
|
||||||
<select class="form-control" data-field="notificationType_new-topic">
|
|
||||||
<option value="none">[[notifications:none]]</option>
|
|
||||||
<option value="notification">[[notifications:notification_only]]</option>
|
|
||||||
<option value="email">[[notifications:email_only]]</option>
|
|
||||||
<option value="notificationemail">[[notifications:notification_and_email]]</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-xs-7">
|
|
||||||
<label>[[notifications:notificationType_new-reply]]</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-xs-5">
|
|
||||||
<select class="form-control" data-field="notificationType_new-reply">
|
|
||||||
<option value="none">[[notifications:none]]</option>
|
|
||||||
<option value="notification">[[notifications:notification_only]]</option>
|
|
||||||
<option value="email">[[notifications:email_only]]</option>
|
|
||||||
<option value="notificationemail">[[notifications:notification_and_email]]</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-xs-7">
|
|
||||||
<label>[[notifications:notificationType_follow]]</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-xs-5">
|
|
||||||
<select class="form-control" data-field="notificationType_follow">
|
|
||||||
<option value="none">[[notifications:none]]</option>
|
|
||||||
<option value="notification">[[notifications:notification_only]]</option>
|
|
||||||
<option value="email">[[notifications:email_only]]</option>
|
|
||||||
<option value="notificationemail">[[notifications:notification_and_email]]</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-xs-7">
|
|
||||||
<label>[[notifications:notificationType_new-chat]]</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-xs-5">
|
|
||||||
<select class="form-control" data-field="notificationType_new-chat">
|
|
||||||
<option value="none">[[notifications:none]]</option>
|
|
||||||
<option value="notification">[[notifications:notification_only]]</option>
|
|
||||||
<option value="email">[[notifications:email_only]]</option>
|
|
||||||
<option value="notificationemail">[[notifications:notification_and_email]]</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-xs-7">
|
|
||||||
<label>[[notifications:notificationType_group-invite]]</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-xs-5">
|
|
||||||
<select class="form-control" data-field="notificationType_group-invite">
|
|
||||||
<option value="none">[[notifications:none]]</option>
|
<option value="none">[[notifications:none]]</option>
|
||||||
<option value="notification">[[notifications:notification_only]]</option>
|
<option value="notification">[[notifications:notification_only]]</option>
|
||||||
<option value="email">[[notifications:email_only]]</option>
|
<option value="email">[[notifications:email_only]]</option>
|
||||||
@@ -370,6 +307,8 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- END notificationSettings -->
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user