-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New posts can go below the line if the body is short #207
Comments
Here are some old posts from lainchan with some anon explaining the posts below the line bug #207 as it existed back then, as well as a few related bugs. Parts of the explanation are likely to still apply to the current leftypol. 2019-03-13 14:51:52 No.12838 if ($("div.post").length > 1){ The structure of div.thread in a thread page without JS is defined by templates/post_thread.html, templates/post_reply.html and templates/post. It looks like this: a.post_anchor https://github.com/lainchan/lainchan/blob/master/templates/post_thread.html The effect of inserting the wrong element, div.post.reply, is that the next insertion, which will take the first branch, will find that the last reply's .parent() is the div.thread, the .next() is the div.thread-interactions, and will insert after that, completely outside the reply list. This is the mechanism by which replies can end up under the separator line. This effect can be deterministically replicated by the following procedure.
2019-03-13 21:57:10 No.12844 $('div.postcontainer').remove (); which reduces the thread to the op. Clicking '[Update]' then demonstrates the effect. 2019-03-17 04:09:58 No.12885 $(data).find('div.post.reply').each(function() { This seems reasonable in isolation, since it avoids readding existing replies. The problem appears in js/post-hover.js which attempts to support hovering over crossboard links. var mythreadid = $(data).find('div[id^="thread_"]').attr('id').replace("thread_", ""); if (mythreadid == threadid && parentboard == board) { If the post belongs to this thread, or to a thread already stored in this one, it is added as a hidden post to the top of its thread in reverse order. If the post belongs to another thread not yet stored in this one, its entire div.thread is added as a hidden element to the top of the postcontrols form. This can be observed in the new CA thread >>12868 where someone linked the old one from the archive. Before hovering over the archive link the postcontrols form starts with the hidden input and div.thread#thread_9558. After hovering over the archive link the postcontrols form acquires a hidden div.thread#thread_17 as its first child. In this particular case this will not be a problem, because all post numbers in the old thread are lower than all post numbers in the new thread. The problem is that while post numbers are unique within a board, they are not unique across boards. By storing a foreign thread in the current one, post-hover.js risks duplicating post numbers and thus duplicating ids, which is already illegal in plain HTML. The id namespace of a page is flat, so care must be taken to separate ids that use the same post number. For example, templates/post_reply.html uses #pcNNN for post containers and reply_NNN for replies. Auto-reload.js can skip posts like this. If the current thread has a crossboard link to a thread with higher ids, that thread is stored in the current one upon hover. If the current thread then receives a new reply with a post number that is already used in the foreign thread, that reply will not pass the insertion test and auto-reload.js will not add it, believing it to be already present. The solution is to either have post-hover.js use a different storage location for foreign threads, outside the DOM, or to apply namespacing to all ids inserted from foreign threads, using their board name. For example, the foreign thread's div.thread could be traversed and any id modified with the foreign board name as a prefix or suffix. The same scheme would then be used for looking up foreign posts. No offense to the original Tinyboard crew but the architecture of JS extensions is looking increasingly like a haphazardly thrown together pile of good intentions, held up by hope and faith. 2019-03-17 12:32:38 No.12887
2019-03-20 11:32:23 No.12913 $(data).find('div.post.reply').each(function() {
2019-03-29 00:51:32 No.13036 To deal with this in the general case, binary search can be used to find the insertion point that maintains the sorted list invariant at every step. To accelerate the most common case of a new reply, the higher end can be tested first. To avoid each inserter script having to reinvent the wheel, sorted post insertion that correctly handles OP-only threads should be moved into a common utility function. |
It can be fixed with a refresh.
The text was updated successfully, but these errors were encountered: