mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 18:56:15 +01:00
closes #3818
set the value saved to empty string if the email is identical to original this causes the original to be used since empty string is falsy
This commit is contained in:
@@ -34,16 +34,23 @@ define('admin/settings/email', ['admin/settings'], function(settings) {
|
||||
emailEditor.setTheme("ace/theme/twilight");
|
||||
emailEditor.getSession().setMode("ace/mode/html");
|
||||
|
||||
emailEditor.on('change', function(event) {
|
||||
$('#email-editor-holder').val(emailEditor.getValue());
|
||||
emailEditor.on('change', function() {
|
||||
var emailPath = $('#email-editor-selector').val();
|
||||
var original;
|
||||
ajaxify.data.emails.forEach(function(email) {
|
||||
if (email.path === emailPath) {
|
||||
original = email.original;
|
||||
}
|
||||
});
|
||||
var newEmail = emailEditor.getValue();
|
||||
$('#email-editor-holder').val(newEmail !== original ? newEmail : '');
|
||||
});
|
||||
|
||||
$('button[data-action="email.revert"]').off('click').on('click', function() {
|
||||
ajaxify.data.emails.forEach(function(email) {
|
||||
if (email.path === $('#email-editor-selector').val()) {
|
||||
emailEditor.getSession().setValue(email.original);
|
||||
$('#email-editor-holder')
|
||||
.val(email.original);
|
||||
$('#email-editor-holder').val('');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -56,7 +63,7 @@ define('admin/settings/email', ['admin/settings'], function(settings) {
|
||||
if (email.path === $('#email-editor-selector').val()) {
|
||||
emailEditor.getSession().setValue(email.text);
|
||||
$('#email-editor-holder')
|
||||
.val(email.text)
|
||||
.val(email.text !== email.original ? email.text : '')
|
||||
.attr('data-field', 'email:custom:' + email.path);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -19,9 +19,9 @@ settingsController.get = function(req, res, next) {
|
||||
|
||||
|
||||
function renderEmail(req, res, next) {
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
utils = require('../../../public/src/utils');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var utils = require('../../../public/src/utils');
|
||||
|
||||
var emailsPath = path.join(__dirname, '../../../public/templates/emails');
|
||||
utils.walk(emailsPath, function(err, emails) {
|
||||
|
||||
Reference in New Issue
Block a user