Completely removed CKEditor 5

Some fixes of bugs from testing in production env.
This commit is contained in:
Tomas Bures 2018-11-24 00:48:41 -05:00
parent d459f7cfed
commit 43c6b58793
17 changed files with 2901 additions and 440 deletions

View file

@ -11,6 +11,7 @@ const favicon = require('serve-favicon');
const logger = require('morgan');
const cookieParser = require('cookie-parser');
const session = require('express-session');
const RedisStore = require('connect-redis')(session);
const flash = require('connect-flash');
const hbs = require('hbs');
const compression = require('compression');
@ -157,6 +158,7 @@ function createApp(appType) {
app.use(cookieParser());
app.use(session({
store: config.redis.enabled ? new RedisStore(config.redis) : false,
secret: config.www.secret,
saveUninitialized: false,
resave: false

View file

@ -48,6 +48,16 @@ enabledLanguages:
# customSubscriptionScripts: [/custom/hello-world.js]
# Enable to use Redis session cache or disable if Redis is not installed
redis:
enabled: false
host: localhost
port: 6379
db: 5
# Uncomment if your Redis installation requires a password
# password=""
# If you start out as a root user (eg. if you want to use ports lower than 1000)
# then you can downgrade the user once all services are up and running
#user: mailtrain

View file

@ -108,6 +108,7 @@ async function create(context, listId, entity, files) {
const filteredEntity = filterObject(entity, allowedKeysCreate);
filteredEntity.list = listId;
filteredEntity.settings = JSON.stringify(filteredEntity.settings);
filteredEntity.status = entity.status;
filteredEntity.mapping_type = MappingType.BASIC_SUBSCRIBE; // This is not set in the create form. It can be changed in the update form.
filteredEntity.mapping = JSON.stringify({});

View file

@ -16,7 +16,7 @@ const dependencyHelpers = require('../lib/dependency-helpers');
const UnsubscriptionMode = require('../../shared/lists').UnsubscriptionMode;
const allowedKeys = new Set(['name', 'description', 'default_form', 'public_subscribe', 'unsubscription_mode', 'contact_email', 'homepage', 'namespace', 'to_name', 'listunsubscribe_disabled']);
const allowedKeys = new Set(['name', 'description', 'default_form', 'public_subscribe', 'unsubscription_mode', 'contact_email', 'homepage', 'namespace', 'to_name', 'listunsubscribe_disabled', 'send_configuration']);
function hash(entity) {
return hasher.hash(filterObject(entity, allowedKeys));
@ -130,6 +130,7 @@ async function create(context, entity) {
' `status` tinyint(4) unsigned NOT NULL DEFAULT \'1\',\n' +
' `is_test` tinyint(4) unsigned NOT NULL DEFAULT \'0\',\n' +
' `status_change` timestamp NULL DEFAULT NULL,\n' +
' `unsubscribed` timestamp NULL DEFAULT NULL,\n' +
' `latest_open` timestamp NULL DEFAULT NULL,\n' +
' `latest_click` timestamp NULL DEFAULT NULL,\n' +
' `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n' +
@ -145,6 +146,8 @@ async function create(context, entity) {
' KEY `created` (`created`)\n' +
') ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;\n');
await shares.rebuildPermissionsTx(tx, { entityTypeId: 'list', entityId: id });
return id;
});
}

View file

@ -125,7 +125,7 @@ async function create(context, entity) {
async function updateWithConsistencyCheck(context, entity) {
await knex.transaction(async tx => {
await shares.enforceEntityPermissionTx(tx, context, 'list', entity.id, 'edit');
await shares.enforceEntityPermissionTx(tx, context, 'sendConfiguration', entity.id, 'edit');
const existing = await tx('send_configurations').where('id', entity.id).first();
if (!existing) {

2939
server/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -50,6 +50,7 @@
"compression": "^1.7.3",
"config": "^2.0.1",
"connect-flash": "^0.1.1",
"connect-redis": "^3.4.0",
"cookie-parser": "^1.4.3",
"cors": "^2.8.5",
"crypto": "^1.0.1",
@ -94,6 +95,7 @@
"nodeify": "^1.0.1",
"nodemailer": "^4.6.8",
"nodemailer-openpgp": "^1.2.0",
"npm": "^6.4.1",
"npmlog": "^4.1.2",
"nyc": "^13.1.0",
"openpgp": "^4.2.1",

View file

@ -782,12 +782,12 @@ async function migrateSettings(knex) {
await knex('settings').del();
await knex('settings').insert([
{ key: 'uaCode', value: settings.uaCode },
{ key: 'shoutout', value: settings.shoutout },
{ key: 'adminEmail', value: settings.adminEmail },
{ key: 'defaultHomepage', value: settings.defaultHomepage },
{ key: 'pgpPassphrase', value: settings.pgpPassphrase },
{ key: 'pgpPrivateKey', value: settings.pgpPrivateKey }
{ key: 'uaCode', value: settings.uaCode || '' },
{ key: 'shoutout', value: settings.shoutout || '' },
{ key: 'adminEmail', value: settings.adminEmail || '' },
{ key: 'defaultHomepage', value: settings.defaultHomepage || '' },
{ key: 'pgpPassphrase', value: settings.pgpPassphrase || '' },
{ key: 'pgpPrivateKey', value: settings.pgpPrivateKey || '' }
]);
}
@ -1284,4 +1284,4 @@ exports.up = (knex, Promise) => (async() => {
})();
exports.down = (knex, Promise) => (async() => {
})();
})();

View file

@ -1,6 +0,0 @@
[www]
port=3000
[mysql]
user="mailtrain_test"
password="bahquaiphoor"
database="mailtrain_test"