Inline reply work for threaded lists in realtime

This commit is contained in:
Brion Vibber 2011-03-01 16:04:11 -08:00
parent 5d6b9936c2
commit 9fd2ee86f3
4 changed files with 20 additions and 6 deletions

View File

@ -654,8 +654,13 @@ var SN = { // StatusNet
var orig_li = $('li', data)[0];
if (orig_li) {
var li = document._importNode(orig_li, true);
replyItem.replaceWith(li);
SN.U.NoticeInlineReplyPlaceholder(parentNotice);
if ($("#notice-"+id).length == 0) {
replyItem.replaceWith(li);
SN.U.NoticeInlineReplyPlaceholder(parentNotice);
} else {
// Realtime came through before us...
replyItem.remove();
}
}
}
});

2
js/util.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -173,7 +173,15 @@ RealtimeUpdate = {
if (threaded && data.in_reply_to_status_id) {
// aho!
var parent = $('#notice-' + data.in_reply_to_status_id);
if (parent.length > 0) {
if (parent.length == 0) {
// @todo fetch the original, insert it, and finish the rest
} else {
// Check the parent notice to make sure it's not a reply itself.
// If so, use it's parent as the parent.
var parentList = parent.closest('.notices');
if (parentList.hasClass('threaded-notices')) {
parent = parentList.closest('.notice');
}
list = parent.find('.threaded-notices');
if (list.length == 0) {
list = $('<ul class="notices threaded-notices xoxo"></ul>');
@ -188,10 +196,11 @@ RealtimeUpdate = {
list.prepend(newNotice);
} else {
var placeholder = list.find('li.notice-reply-placeholder')
if (placeholder) {
if (placeholder.length > 0) {
newNotice.insertBefore(placeholder)
} else {
newNotice.appendTo(list);
SN.U.NoticeInlineReplyPlaceholder(parent);
}
}
newNotice.css({display:"none"}).fadeIn(1000);

File diff suppressed because one or more lines are too long