Update personal data downloader

This commit is contained in:
Pierre HUBERT 2021-03-08 16:31:47 +01:00
parent 45db26bbd5
commit 651bfb4e8d

View File

@ -158,17 +158,16 @@ ComunicWeb.components.account.export.worker = {
*/ */
_generate_files_list: function(data){ _generate_files_list: function(data){
var files = []; var files = new Set();
/** /**
* Parse user information to find potential files to download * Parse user information to find potential files to download
* *
* @param {Object} info Information about the comment to parse * @param {Object} info Information about the user to parse
*/ */
var parseUserInfo = function(info){ var parseUserInfo = function(info){
if(info.accountImage != null) if(info.accountImage != null)
if(!files.includes(info.accountImage)) files.add(info.accountImage);
files.push(info.accountImage);
} }
/** /**
@ -178,8 +177,7 @@ ComunicWeb.components.account.export.worker = {
*/ */
var parseComment = function(info){ var parseComment = function(info){
if(info.img_url != null) if(info.img_url != null)
if(!files.includes(info.img_url)) files.add(info.img_url);
files.push(info.img_url);
} }
/** /**
@ -191,8 +189,7 @@ ComunicWeb.components.account.export.worker = {
if(post.kind != "youtube"){ if(post.kind != "youtube"){
if(post.file_path_url != null){ if(post.file_path_url != null){
if(!files.includes(post.file_path_url)) files.add(post.file_path_url);
files.push(post.file_path_url);
} }
} }
@ -203,18 +200,21 @@ ComunicWeb.components.account.export.worker = {
/** /**
* Parse a conversation message to find potential files to download * Parse a conversation message to find potential files to download
* *
* @param {Object} info Information about the conversation to parse * @param {ConversationMessage} info Information about the conversation message to parse
*/ */
var parseConversationMessage = function(info){ var parseConversationMessage = function(info){
if(info.image_path != null) if(info.file != null)
if(!files.includes(info.image_path)) {
files.push(info.image_path); files.add(info.file.url);
if (info.file.thumbnail)
files.add(info.file.thumbnail)
}
} }
//Main account information //Main account information
files.push(data.advanced_info.accountImage); files.add(data.advanced_info.accountImage);
files.push(data.advanced_info.backgroundImage);
//Posts //Posts
data.posts.forEach(parsePost); data.posts.forEach(parsePost);