Inline reply work for threaded lists in realtime
This commit is contained in:
parent
5d6b9936c2
commit
9fd2ee86f3
@ -654,8 +654,13 @@ var SN = { // StatusNet
|
|||||||
var orig_li = $('li', data)[0];
|
var orig_li = $('li', data)[0];
|
||||||
if (orig_li) {
|
if (orig_li) {
|
||||||
var li = document._importNode(orig_li, true);
|
var li = document._importNode(orig_li, true);
|
||||||
replyItem.replaceWith(li);
|
if ($("#notice-"+id).length == 0) {
|
||||||
SN.U.NoticeInlineReplyPlaceholder(parentNotice);
|
replyItem.replaceWith(li);
|
||||||
|
SN.U.NoticeInlineReplyPlaceholder(parentNotice);
|
||||||
|
} else {
|
||||||
|
// Realtime came through before us...
|
||||||
|
replyItem.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
2
js/util.min.js
vendored
2
js/util.min.js
vendored
File diff suppressed because one or more lines are too long
@ -173,7 +173,15 @@ RealtimeUpdate = {
|
|||||||
if (threaded && data.in_reply_to_status_id) {
|
if (threaded && data.in_reply_to_status_id) {
|
||||||
// aho!
|
// aho!
|
||||||
var parent = $('#notice-' + data.in_reply_to_status_id);
|
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');
|
list = parent.find('.threaded-notices');
|
||||||
if (list.length == 0) {
|
if (list.length == 0) {
|
||||||
list = $('<ul class="notices threaded-notices xoxo"></ul>');
|
list = $('<ul class="notices threaded-notices xoxo"></ul>');
|
||||||
@ -188,10 +196,11 @@ RealtimeUpdate = {
|
|||||||
list.prepend(newNotice);
|
list.prepend(newNotice);
|
||||||
} else {
|
} else {
|
||||||
var placeholder = list.find('li.notice-reply-placeholder')
|
var placeholder = list.find('li.notice-reply-placeholder')
|
||||||
if (placeholder) {
|
if (placeholder.length > 0) {
|
||||||
newNotice.insertBefore(placeholder)
|
newNotice.insertBefore(placeholder)
|
||||||
} else {
|
} else {
|
||||||
newNotice.appendTo(list);
|
newNotice.appendTo(list);
|
||||||
|
SN.U.NoticeInlineReplyPlaceholder(parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newNotice.css({display:"none"}).fadeIn(1000);
|
newNotice.css({display:"none"}).fadeIn(1000);
|
||||||
|
2
plugins/Realtime/realtimeupdate.min.js
vendored
2
plugins/Realtime/realtimeupdate.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user