update attachment data attribute and thumbnails on any attachment data change

This commit is contained in:
Hannes Mannerheim 2015-11-25 21:00:30 +01:00
parent 8e210301cd
commit 73a77a02fb

View File

@ -713,16 +713,16 @@ function searchForUpdatedNoticeData(obj) {
queetFoundInFeed.find('.stream-item-header').find('strong.name').html(obj.user.name); queetFoundInFeed.find('.stream-item-header').find('strong.name').html(obj.user.name);
} }
// attachments might have been added (have had time to be processed) // attachments might have been added/changed/have had time to be processed
var existingAttachments = streamItemFoundInFeed.attr('data-attachments'); if(streamItemFoundInFeed.attr('data-attachments') != JSON.stringify(obj.attachments)) {
if((existingAttachments == 'undefined' || existingAttachments == '' || existingAttachments == 'false')
&& queetFoundInFeed.find('.queet-thumbs').hasClass('thumb-num-0')
&& typeof obj.attachments != 'undefined') {
streamItemFoundInFeed.attr('data-attachments',JSON.stringify(obj.attachments)); streamItemFoundInFeed.attr('data-attachments',JSON.stringify(obj.attachments));
var attachmentsHTMLBuild = buildAttachmentHTML(obj.attachments); // we might want to add thumbnails
queetFoundInFeed.find('.queet-thumbs').removeClass('thumb-num-0'); if(queetFoundInFeed.find('.queet-thumbs').hasClass('thumb-num-0')) {
queetFoundInFeed.find('.queet-thumbs').addClass('thumb-num-' + attachmentsHTMLBuild.num); var attachmentsHTMLBuild = buildAttachmentHTML(obj.attachments);
queetFoundInFeed.find('.queet-thumbs').html(attachmentsHTMLBuild.html); queetFoundInFeed.find('.queet-thumbs').removeClass('thumb-num-0');
queetFoundInFeed.find('.queet-thumbs').addClass('thumb-num-' + attachmentsHTMLBuild.num);
queetFoundInFeed.find('.queet-thumbs').html(attachmentsHTMLBuild.html);
}
} }
// set favorite data // set favorite data