Browse Source

don't trust dhtget ordering, mentions/hashtags must be sorted by date. much better now.

master
Miguel Freitas 11 years ago
parent
commit
0ee1b64be5
  1. 24
      twister_actions.js
  2. 2
      twister_timeline.js

24
twister_actions.js

@ -223,8 +223,28 @@ function processHashtag(postboard, hashtag, data) { @@ -223,8 +223,28 @@ function processHashtag(postboard, hashtag, data) {
function displayHashtagPending(postboard) {
for( var i = 0; i < _hashtagPendingPosts.length; i++ ) {
var newStreamPost = postToElem(_hashtagPendingPosts[i], "original");
postboard.prepend( newStreamPost );
var streamPost = postToElem(_hashtagPendingPosts[i], "original");
var timePost = _hashtagPendingPosts[i]["userpost"]["time"];
var streamItems = postboard.children();
if( streamItems.length == 0) {
postboard.prepend( streamPost );
} else {
var j = 0;
for( j = 0; j < streamItems.length; j++) {
var streamItem = streamItems.eq(j);
var timeItem = streamItem.attr("data-time");
if( timeItem == undefined ||
timePost > parseInt(timeItem) ) {
// this post in stream is older, so post must be inserted above
streamItem.before(streamPost);
break;
}
}
if( j == streamItems.length ) {
postboard.append( streamPost );
}
}
}
$.MAL.postboardLoaded();
_hashtagPendingPosts = [];

2
twister_timeline.js

@ -146,7 +146,7 @@ function processReceivedPosts(req, posts) @@ -146,7 +146,7 @@ function processReceivedPosts(req, posts)
streamPostAppended = true;
} else {
var j = 0;
for( var j = 0; j < streamItems.length; j++) {
for( j = 0; j < streamItems.length; j++) {
var streamItem = streamItems.eq(j);
var timeItem = streamItem.attr("data-time");
if( timeItem == undefined ||

Loading…
Cancel
Save