Browse Source

Merge pull request #283 from erqan/replied_promoted_post

show replied promoted post and don't show the sent indicator with pro…
master
miguelfreitas 9 years ago
parent
commit
cae8989f21
  1. 21
      js/twister_actions.js
  2. 4
      js/twister_formatpost.js

21
js/twister_actions.js

@ -29,8 +29,9 @@ function requestRepliedBefore(postLi)
var reply_k = originalPost.attr('data-replied-to-id'); var reply_k = originalPost.attr('data-replied-to-id');
if( reply_n != undefined && reply_k != undefined ) { if( reply_n != undefined && reply_k != undefined ) {
dhtget( reply_n, "post" + reply_k, "s", if (reply_n[0] !== '!') {
function(postLi, postFromJson) { dhtget(reply_n, "post" + reply_k, "s",
function (postLi, postFromJson) {
if (postFromJson) { if (postFromJson) {
postLi.find('textarea').textcomplete('destroy'); // FIXME maybe we need to reset position instead (but curently it's cheaper) postLi.find('textarea').textcomplete('destroy'); // FIXME maybe we need to reset position instead (but curently it's cheaper)
var newStreamPost = postToElem(postFromJson, "related"); var newStreamPost = postToElem(postFromJson, "related");
@ -41,6 +42,22 @@ function requestRepliedBefore(postLi)
requestRepliedBefore(newStreamPost); requestRepliedBefore(newStreamPost);
} }
}, postLi); }, postLi);
} else {
//replied to a promoted post... try to get it..
var params = [1, parseInt(reply_k)];
twisterRpc("getspamposts", params,
function (postLi, postFromJson) {
if (postFromJson) {
postLi.find('textarea').textcomplete('destroy'); // FIXME maybe we need to reset position instead (but curently it's cheaper)
var newStreamPost = postToElem(postFromJson[0], "related", 1);
newStreamPost.hide();
postLi.before(newStreamPost);
newStreamPost.slideDown("fast");
$.MAL.relatedPostLoaded();
requestRepliedBefore(newStreamPost);
}
}, postLi, function(arg,ret) {console.log(ret)});
}
} }
} }

4
js/twister_formatpost.js

@ -108,7 +108,6 @@ function postToElem( post, kind, promoted ) {
postInfoName.text(n).attr('href', $.MAL.userUrl(n)); postInfoName.text(n).attr('href', $.MAL.userUrl(n));
getFullname( n, postInfoName ); getFullname( n, postInfoName );
//elem.find('.post-info-tag').text("@" + n); //elem.find('.post-info-tag').text("@" + n);
setPostInfoSent(n,k,elem.find('.post-info-sent'));
getAvatar( n, elem.find('.avatar') ); getAvatar( n, elem.find('.avatar') );
elem.find('.post-info-time').text(timeGmtToText(t)).attr('title', timeSincePost(t)); elem.find('.post-info-time').text(timeGmtToText(t)).attr('title', timeSincePost(t));
@ -143,7 +142,10 @@ function postToElem( post, kind, promoted ) {
if (typeof(promoted) !== 'undefined' && promoted) { if (typeof(promoted) !== 'undefined' && promoted) {
elem.find('.post-propagate').remove(); elem.find('.post-propagate').remove();
postData.attr('data-promoted', 1);
postData.attr('data-screen-name', '!' + n);
} else { } else {
setPostInfoSent(n,k,elem.find('.post-info-sent'));
if ($.Options.filterLang.val !== 'disable' && $.Options.filterLangSimulate.val) { if ($.Options.filterLang.val !== 'disable' && $.Options.filterLangSimulate.val) {
// FIXME it's must be stuff from template actually // FIXME it's must be stuff from template actually
if (typeof(post['langFilter']) !== 'undefined') { if (typeof(post['langFilter']) !== 'undefined') {

Loading…
Cancel
Save