ccd0 / 4chan-x

Adds various features to anonymous imageboards.
https://www.4chan-x.net/
Other
989 stars 135 forks source link

Filter hiding cancels out highlighting #3359

Open saxamaphone69 opened 1 year ago

saxamaphone69 commented 1 year ago

Only because I'm stressing over trying to get #126 working again, I've noticed that posts can only get hidden or highlighted, not both. This used to work in Mayhem's version.

Say for example, I have a generic filter where posts with a GIF file are given the .file--gif class, so I can apply CSS to that post.

image

If a post matches a hiding filter, then the highlight filter is not applied, even after unhiding the stub.

image

Of course, if someone is hiding a post, they probably don't want it highlighted. But if they go to unhide the stub/post, and it was going to match a highlighting feature, I figure that should be there. And the default .filter-highlight class would not affect the stub. I guess inversely if a post is highlighted and then manually hidden, it should retain the knowledge it was highlighted.

From what I can tell, this is because Filter.coffee "forces" posts to be one or the other. Returning the whole Object at https://github.com/ccd0/4chan-x/blob/master/src/Filtering/Filter.coffee#L152 instead and not making https://github.com/ccd0/4chan-x/blob/master/src/Filtering/Filter.coffee#L165 an else seems to do the job. Though I can see catalog posts are treated different.

Still trying to use this commit as reference, but the structure of these files have changed a fair bit in the last decade. Mainly the introduction of the type: setting is stopping me from progressing, as I don't quite understand how to give the reason Post hidden due to the comment containing /x/i; or Post highlighted due to the flag being /Australia/i. Hopefully I can eventually work it out, unless someone else does.

saxamaphone69 commented 1 year ago

Related: #1205 and a PR #3284

saxamaphone69 commented 1 year ago

Random thought too, if Filter Labels ever got done, is if a filter hid every single thread on a board, or post in a thread, that it should display a notification to let the user know "The following filter: _____ matches every post, you may want to check it" or something like that, which should then alleviate issues of people claiming it's 4chan X's fault all posts are hidden.