From 1ae92eeac871b4187779341a9bb001598534dcea Mon Sep 17 00:00:00 2001 From: Pierre Date: Sun, 27 May 2018 12:10:42 +0200 Subject: [PATCH] Updated parser. --- assets/js/components/account/export/worker.js | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/assets/js/components/account/export/worker.js b/assets/js/components/account/export/worker.js index 3043ad8e..8f017cfe 100644 --- a/assets/js/components/account/export/worker.js +++ b/assets/js/components/account/export/worker.js @@ -130,6 +130,17 @@ ComunicWeb.components.account.export.worker = { var files = []; + /** + * Parse user information to find potential files to download + * + * @param {Object} info Information about the comment to parse + */ + var parseUserInfo = function(info){ + if(info.accountImage != null) + if(!files.includes(info.accountImage)) + files.push(info.accountImage); + } + /** * Parse a comment to find potential files to download * @@ -196,7 +207,23 @@ ComunicWeb.components.account.export.worker = { data.movies.forEach(parseMovie); //Conversation message - data.conversation_messages.forEach(parseConversationMessage); + //* All from users + data.all_conversation_messages.forEach(parseConversationMessage); + + //* All from conversations + for (const num in data.conversations_messages) { + if (data.conversations_messages.hasOwnProperty(num)) { + const conversation = data.conversations_messages[num]; + conversation.forEach(parseConversationMessage); + } + } + + //Related user information + for (const key in data.users_info) { + if (data.users_info.hasOwnProperty(key)) { + parseUserInfo(data.users_info[key]); + } + } return files; }