Work in progress on introducing tag language. Not tested yet.

This commit is contained in:
Tomas Bures 2019-07-03 11:58:58 +02:00
parent 450b930cc5
commit 00e328a914
21 changed files with 2154 additions and 1909 deletions

View file

@ -2,6 +2,7 @@ const { CampaignSource, CampaignType} = require('../../../../shared/campaigns');
const files = require('../../../models/files');
const contextHelpers = require('../../../lib/context-helpers');
const mosaicoTemplates = require('../../../../shared/mosaico-templates');
const {TagLanguages} = require('../../../../shared/templates');
const {getGlobalNamespaceId} = require('../../../../shared/namespaces');
const {getAdminId} = require('../../../../shared/users');
const { MailerType, ZoneMTAType, getSystemSendConfigurationId, getSystemSendConfigurationCid } = require('../../../../shared/send-configurations');
@ -905,7 +906,7 @@ async function addMosaicoTemplates(knex) {
type: 'html',
namespace: 1,
data: JSON.stringify({
html: mosaicoTemplates.getVersafix()
html: mosaicoTemplates.getVersafix(TagLanguages.SIMPLE)
})
};

View file

@ -7,7 +7,7 @@ exports.up = (knex, Promise) => (async() => {
data.listId = queuedEntry.list;
data.subscriptionId = queuedEntry.subscription;
knex('queued')
await knex('queued')
.where('id', queuedEntry.id)
.update({
data: JSON.stringify(data)

View file

@ -0,0 +1,41 @@
const { CampaignSource } = require('../../../../shared/campaigns');
const { TagLanguages } = require('../../../../shared/templates');
exports.up = (knex, Promise) => (async() => {
await knex.schema.table('templates', table => {
table.string('tag_language', 48);
});
await knex('templates').update({
tag_language: 'simple'
});
await knex.schema.table('templates', table => {
table.string('tag_language', 48).notNullable().index().alter();
});
await knex.schema.table('mosaico_templates', table => {
table.string('tag_language', 48);
});
await knex('mosaico_templates').update({
tag_language: TagLanguages.SIMPLE
});
await knex.schema.table('mosaico_templates', table => {
table.string('tag_language', 48).notNullable().index().alter();
});
const rows = await knex('campaigns').whereIn('source', [CampaignSource.CUSTOM, CampaignSource.CUSTOM_FROM_CAMPAIGN, CampaignSource.CUSTOM_FROM_TEMPLATE]);
for (const row of rows) {
const data = JSON.parse(row.data);
data.sourceCustom.tag_language = TagLanguages.SIMPLE;
await knex('campaigns').where('id', row.id).update({data: JSON.stringify(data)});
}
})();
exports.down = (knex, Promise) => (async() => {
})();