From ac973ee753c9001dd683f8a0764b5f2da2c4bf55 Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Fri, 18 May 2018 18:04:32 +0200 Subject: [PATCH] fix(tests): do not error when test chat messages miss the timestamp attribute --- website/server/models/group.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/server/models/group.js b/website/server/models/group.js index 65b49aee45..5ab0b154c9 100644 --- a/website/server/models/group.js +++ b/website/server/models/group.js @@ -348,7 +348,7 @@ schema.statics.toJSONCleanChat = async function groupToJSONCleanChat (group, use toJSON.chat.forEach(chat => { // old chats are saved with a numeric timestamp // new chats use `Date` which then has to be converted to the numeric timestamp - if (chat.timestamp.getTime) { + if (chat.timestamp && chat.timestamp.getTime) { chat.timestamp = chat.timestamp.getTime(); } });