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.
This commit is contained in:
Tom Hall 2018-09-02 12:56:57 +01:00
parent 4aa36965a5
commit 2e95d8cb43

View file

@ -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;
}