Appending `?context=#` to a permalink will highlight the permalinked
comment and display above it up to 8 ancestors, similar to Reddit's
behaviour. To keep things fast, this update required that the Pushshift
comments endpoint work with `ids` queries which was fixed around May 11.
Comments in the time ranges below need a workaround which slows down
Pushshift queries, but it's required to retrieve them correctly
* Sep/1/2017 0:00 - Sep/30/2017 23:59:59 UTC
* Feb/1/2018 0:00 - Mar/31/2018 23:59:59 UTC
Beforehand, visiting a permalink would cause Unddit to begin loading
from the Post's first comment. If the max-to-download setting was too
small, and the permalinked comment wasn't yet encountered, no comment
tree would be displayed.
Now, only comments that occur at the same time as the permalinked
comment or later (chronologically) are downloaded.
This also adds a Parent link to each comment. When viewing a permalinked
comment, clicking the top-level Parent link will download only new
comments between the parent and child comments. Likewise, clicking the
'view rest of comments' link will only download new comments from the
first comment up until the previously viewed comment.
In general, Unddit will not re-download comments that it knows it has
previously downloaded, nor download more than max-to-download comments
per link clicked. This can leave 'gaps' in the list of downloaded
comments. If the 'load more comments' link is clicked, Unddit will only
download comments that can fill such gaps between the currently-linked
permalink (or if not viewing one, the first comment) and the last, up to
the max-to-download setting.
maxComments is now only the user-preferred setting, and has nothing to
do with displayed state. loadingMoreComments is used to trigger loading
more comments, and temporarily contains the desired comment count to
load. This should make future changes easier. Also fix two minor bugs:
* the 'Reload' was sometimes hidden after clicking 'load more comments'
* 'loaded x more comments' incorrectly appeared after clicking 'Reload'
Beforehand, Pushshift comments were all downloaded first, then they were
processed, then all Reddit comments were downloaded, then processed.
Now, as each batch of Pushshift comments completes, it is processed
asynchronously, and Reddit comments are downloaded & processed as soon
as enough comment IDs have been batched for submission. This minimizes
the amount of time spent in the 'Comparing comments to Reddit API'
phase. It also spaces out Reddit API requests for better netiquette.
* only rerender the comments after loading and iff something changes
* change text to 'loading...' and make link unclickable while waiting
* if all comments are already loaded, rename to 'load new comments'
Also update the reddit endpoint for posts, and add the capability
to download from Pushshift in multiple batches, with a binary
backoff; it's currently set to download up to 1,000 comments.
Credit (once again) to @ayan4m1 for a couple snippets of code.