-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add ability to watch threads via filters #2925
base: master
Are you sure you want to change the base?
Conversation
I feel like https://find.4chan.org/ could be utilised to do something here. https://boards.4chan.org/search?#/%224chan%20x%22 That way it would search all of 4chan, or could filter per board. |
Probably not a bad idea, but would require a lot more work. This one can sort of piggy-back off the existing infastructure |
The native extension version queries the board's catalog.json when the thread watcher is updated whereas this only adds it to your watchlist if you actually visit a page containing the thread. Do you still find this useful? If so, it could be extended to query catalog.json in the future by adding some code to ThreadWatcher.parseBoard. But the present limitation should be documented. |
I'll look into getting it to add some checks to the parseBoard call, doesn't sound too difficult. I normally browse in catalog mode anyway, and while testing got every thread on /v/ added to my watcher. Looking over it, seems like the catalog.json is called rather infrequently, via |
Module scans current filters, and on finding any watch filters, periodically (every 5m) scans all boards set by said filters, and adds any matches to the WatchList. The other, dumb matching is still present, as it lets users get watches without specifying a board, and wont do anything to matches we already have from this
I've added a module that works similarly to how the Native Extensions auto watch works. You have to have a If the user does not specify boards, then it works like it did when I originally opened this PR; it only scans where the user visits. Useful for catching threads you care about on boards you dont visit often, or threads that have comments IN them that are of interest to you |
acc[k] ?= [] | ||
acc[k].push(v) | ||
acc | ||
, {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs $.dict() [which calls Object.create(null)] instead of {} here.
Should also deduplicate boards and not just sites, and ignore "siteID/*" as a board.
"No.#{parsedThread.ID}" | ||
) | ||
excerpt = "/#{boardID}/ - #{excerptName}" | ||
excerpt = "#{excerpt[...70]}..." if excerpt.length > 73 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid duplicating the code in Get.threadExcerpt. Instead we should make Get.threadExcerpt handle posts from JSON. The comment could be dealt with similar to how Filter does it, in this case using parseCommentDisplay in preference to parseComment if available to filter junk out of the comment:
https://github.com/ccd0/4chan-x/blob/1.14.21.3/src/Filtering/Filter.coffee#L219
'AutoWatcher' | ||
onLoadEnd, | ||
{timeout: $.MINUTE, ajax} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if it's possible to combine these periodic fetches with ThreadWatcher's periodic fetches so that less fetches have to take place, but that might be too much complexity.
@@ -168,6 +173,9 @@ Filter = | |||
$.addClass @nodes.root, hl... | |||
if noti and Unread.posts and (@ID > Unread.lastReadPost) and not QuoteYou.isYou(@) | |||
Unread.openNotification @, ' triggered a notification filter' | |||
if watch and !ThreadWatcher.isWatched(@thread) | |||
ThreadWatcher.add(@thread) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This watches the thread if it sees any reply to the thread that matches the filter. Is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I figure they could have op: only to match starting posts.
Adds the ability to make a filter trigger a thread watch, on use of the
watch
modifier for filters.Ex:
Subject
Fixes #1471, #2361, #2490, and probably many more