Commit 9fd2ee86 authored by Brion Vibber's avatar Brion Vibber

Inline reply work for threaded lists in realtime

parent 5d6b9936
......@@ -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();
}
}
}
});
......
This diff is collapsed.
......@@ -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);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment