|
|
@ -78,24 +78,29 @@ function requestDmConversation(postboard, dm_screenname) { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function processDmConversation(postboard, dm_screenname, dmData) { |
|
|
|
function processDmConversation(stream, peerAlias, posts) { |
|
|
|
var lastId = undefined; |
|
|
|
var streamItems = stream.children(); |
|
|
|
|
|
|
|
var streamPostsIDs = []; |
|
|
|
if (dmData[dm_screenname]) { |
|
|
|
|
|
|
|
var dmList = dmData[dm_screenname]; |
|
|
|
for (var i = 0; i < streamItems.length; i++) { |
|
|
|
if (dmList.length) { |
|
|
|
streamPostsIDs.push(parseInt(streamItems.eq(i).attr('data-id'))); |
|
|
|
for (var i = 0; i < dmList.length; i++) { |
|
|
|
} |
|
|
|
var dmItem = postToElemDM(dmList[i], defaultScreenName, dm_screenname) |
|
|
|
|
|
|
|
.attr('data-id', dmList[i].id) |
|
|
|
if (posts[peerAlias] && posts[peerAlias].length) { |
|
|
|
.appendTo(postboard) |
|
|
|
for (var i = 0; i < posts[peerAlias].length; i++) { |
|
|
|
|
|
|
|
if (streamPostsIDs.indexOf(posts[peerAlias][i].id) === -1) { |
|
|
|
|
|
|
|
var lastPostID = posts[peerAlias][i].id; |
|
|
|
|
|
|
|
postToElemDM(posts[peerAlias][i], defaultScreenName, peerAlias) |
|
|
|
|
|
|
|
.attr('data-id', lastPostID) |
|
|
|
|
|
|
|
.appendTo(stream) |
|
|
|
; |
|
|
|
; |
|
|
|
lastId = dmList[i].id; |
|
|
|
streamPostsIDs.push(lastPostID); |
|
|
|
} |
|
|
|
} |
|
|
|
$.MAL.dmChatListLoaded(postboard); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$.MAL.dmChatListLoaded(stream); |
|
|
|
} |
|
|
|
} |
|
|
|
if (typeof lastId !== 'undefined') |
|
|
|
if (typeof lastPostID !== 'undefined') |
|
|
|
resetNewDMsCountForUser(dm_screenname, lastId); |
|
|
|
resetNewDMsCountForUser(peerAlias, lastPostID); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function directMsgSubmit(e) { |
|
|
|
function directMsgSubmit(e) { |
|
|
|