v1.18.x
barisusakli 11 years ago
commit 9312675a77

@ -20,5 +20,7 @@
"digest.unsub.cta": "Click here to alter those settings", "digest.unsub.cta": "Click here to alter those settings",
"digest.daily.no_topics": "There have been no active topics in the past day", "digest.daily.no_topics": "There have been no active topics in the past day",
"test.text1": "This is a test email to verify that the emailer is set up correctly for your NodeBB.",
"closing": "Thanks!" "closing": "Thanks!"
} }

@ -33,6 +33,7 @@
"no-user": "User doesn't exist", "no-user": "User doesn't exist",
"no-teaser": "Teaser doesn't exist", "no-teaser": "Teaser doesn't exist",
"no-privileges": "You don't have enough privileges for this action.", "no-privileges": "You don't have enough privileges for this action.",
"no-emailers-configured": "No email plugins were loaded, so a test email could not be sent",
"category-disabled": "Category disabled", "category-disabled": "Category disabled",

@ -91,12 +91,24 @@ define('forum/admin/settings', ['uploader', 'sounds'], function(uploader, sounds
handleUploads(); handleUploads();
$('#settings-tab a').click(function (e) { $('#settings-tab a').off('click').on('click', function (e) {
e.preventDefault(); e.preventDefault();
$(this).tab('show'); $(this).tab('show');
return false; return false;
}); });
$('button[data-action="email.test"]').off('click').on('click', function() {
socket.emit('admin.email.test', function(err) {
app.alert({
alert_id: 'test_email_sent',
type: !err ? 'info' : 'danger',
title: 'Test Email Sent',
message: err ? err.message : '',
timeout: 2500
});
});
});
if (typeof callback === 'function') { if (typeof callback === 'function') {
callback(); callback();
} }

@ -9,6 +9,7 @@ var groups = require('../groups'),
categories = require('../categories'), categories = require('../categories'),
logger = require('../logger'), logger = require('../logger'),
events = require('../events'), events = require('../events'),
emailer = require('../emailer'),
db = require('../database'), db = require('../database'),
async = require('async'), async = require('async'),
winston = require('winston'), winston = require('winston'),
@ -22,7 +23,8 @@ var groups = require('../groups'),
plugins: {}, plugins: {},
widgets: {}, widgets: {},
config: {}, config: {},
settings: {} settings: {},
email: {}
}; };
SocketAdmin.before = function(socket, method, next) { SocketAdmin.before = function(socket, method, next) {
@ -121,4 +123,16 @@ SocketAdmin.settings.set = function(socket, data, callback) {
meta.settings.set(data.hash, data.values, callback); meta.settings.set(data.hash, data.values, callback);
}; };
SocketAdmin.email.test = function(socket, data, callback) {
if (plugins.hasListeners('action:email.send')) {
emailer.send('test', socket.uid, {
subject: '[NodeBB] Test Email',
site_title: meta.config.site_title || 'NodeBB'
});
callback();
} else {
callback(new Error('[[error:no-emailers-configured]]'));
}
};
module.exports = SocketAdmin; module.exports = SocketAdmin;

Loading…
Cancel
Save