From 300f0977f6b220a298319a5fec6223f6b07ea8cf Mon Sep 17 00:00:00 2001 From: Gerhard Sletten Date: Thu, 12 Dec 2019 15:39:44 +0100 Subject: [PATCH] Need to parse the fields settings to make the date-format available in parsing, and set sql_mode in docker to make dates work even if they are not strict mysql-dates --- docker-compose-local.yml | 1 + docker-compose.yml | 1 + server/models/fields.js | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docker-compose-local.yml b/docker-compose-local.yml index 92128a70..a2b8eb30 100644 --- a/docker-compose-local.yml +++ b/docker-compose-local.yml @@ -10,6 +10,7 @@ services: - MYSQL_PASSWORD=mailtrain volumes: - mysql-data:/var/lib/mysql + command: mysqld --sql_mode="" redis: image: redis:5 diff --git a/docker-compose.yml b/docker-compose.yml index ed8c464b..14c921c5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,7 @@ services: - MYSQL_PASSWORD=mailtrain volumes: - mysql-data:/var/lib/mysql + command: mysqld --sql_mode="" redis: image: redis:5 diff --git a/server/models/fields.js b/server/models/fields.js index 2f7148eb..359481cd 100644 --- a/server/models/fields.js +++ b/server/models/fields.js @@ -310,7 +310,12 @@ async function listTx(tx, listId) { async function list(context, listId) { return await knex.transaction(async tx => { await shares.enforceEntityPermissionTx(tx, context, 'list', listId, ['viewFields']); - return await listTx(tx, listId); + const flds = await listTx(tx, listId); + + return flds.map(fld => { + fld.settings = JSON.parse(fld.settings); + return fld; + }); }); }