diff --git a/js/twister_actions.js b/js/twister_actions.js index 79b25aa..947b19f 100644 --- a/js/twister_actions.js +++ b/js/twister_actions.js @@ -157,8 +157,10 @@ function requestRTs(postLi) } function appendPostToElem(post, elem) { - // posts without 'msg' and 'rt.msg' may be used for metadata like 'url' and are not meant to be displayed - if (!post.userpost.msg && (!post.userpost.rt || (post.userpost.rt && !post.userpost.rt.msg))) + // posts without non-empty strings in both 'msg' and 'rt.msg' may be used for metadata like 'url' and are not meant to be displayed + if ((typeof post.userpost.msg !== 'string' || post.userpost.msg === '') + && (typeof post.userpost.rt !== 'object' + || typeof post.userpost.rt.msg !== 'string' || post.userpost.rt.msg === '')) return; postToElem(post, 'original').hide().appendTo(elem).slideDown('fast'); diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index 61c7804..2210b6d 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -60,7 +60,7 @@ function postToElem(post, kind, promoted) { if (post.sig_wort) userpost.sig_wort = post.sig_wort; - if (userpost.rt && userpost.rt.msg) { + if (userpost.rt && typeof userpost.rt.msg === 'string' && userpost.rt.msg !== '') { rt = userpost.rt; if (userpost.msg) { username = userpost.n; @@ -86,6 +86,8 @@ function postToElem(post, kind, promoted) { content_to_rt = $.toJSON(userpost); content_to_sigrt = post.sig_userpost; } + if (typeof msg !== 'string') + msg = ''; // Now create the html elements var elem = $.MAL.getPostTemplate().clone(true).appendTo(twister.html.detached); diff --git a/js/twister_timeline.js b/js/twister_timeline.js index 23c0382..edf488e 100644 --- a/js/twister_timeline.js +++ b/js/twister_timeline.js @@ -347,8 +347,10 @@ function timelineChangedUser() } function willBeHidden(post) { - // posts without 'msg' and 'rt.msg' may be used for metadata like 'url' and are not meant to be displayed - if (!post.userpost.msg && (!post.userpost.rt || (post.userpost.rt && !post.userpost.rt.msg))) + // posts without non-empty strings in both 'msg' and 'rt.msg' may be used for metadata like 'url' and are not meant to be displayed + if ((typeof post.userpost.msg !== 'string' || post.userpost.msg === '') + && (typeof post.userpost.rt !== 'object' + || typeof post.userpost.rt.msg !== 'string' || post.userpost.rt.msg === '')) return true; if (post['userpost']['n'] === defaultScreenName)