From 2e95d8cb43f83d032b68531de15e6983f64d31b7 Mon Sep 17 00:00:00 2001 From: Tom Hall Date: Sun, 2 Sep 2018 12:56:57 +0100 Subject: [PATCH] Fix #30: display attachments from boosted toots A 'boost' contains a copy of the source toot's text as its content, but it doesn't copy the media_attachments. If the data['reblog'] field is not null, append media_attachments from data['reblog'] as well as from data. --- qml/lib/Worker.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/qml/lib/Worker.js b/qml/lib/Worker.js index 0f52d04..85b22a4 100644 --- a/qml/lib/Worker.js +++ b/qml/lib/Worker.js @@ -252,5 +252,18 @@ function parseToot (data){ } item['attachments'].push(tmp) } + if(item['status_reblog']){ + for(var i = 0; i < data['reblog']['media_attachments'].length ; i++){ + var attachments = data['reblog']['media_attachments'][i]; + item['content'] = item['content'].replaceAll(attachments['text_url'], '') + var tmp = { + id: attachments['id'], + type: attachments['type'], + url: attachments['remote_url'] && typeof attachments['remote_url'] == "string" ? attachments['remote_url'] : attachments['url'], + preview_url: loadImages ? attachments['preview_url'] : '' + } + item['attachments'].push(tmp) + } + } return item; }