RedReader icon indicating copy to clipboard operation
RedReader copied to clipboard

[Feature request] blacklist post titles

Open 251 opened this issue 6 years ago • 9 comments

It would be nice to have a blacklist of strings for post titles, e.g. "cat", "dog", "mods are asleep", ... Nothing fancy (regex), just plain case-insensitive search.

Hope that's not a duplicate - I could only find requests for tag/url-based filters. Thanks for the nice project.

251 avatar Jan 17 '19 20:01 251

Totally with you, so many use-cases

thousandsofthem avatar Feb 02 '19 10:02 thousandsofthem

I'm also interested in this potential feature. Are there any key devs reading this post that could point me in the right direction? I.e. what class(es) would need to be changed to accommodate?

Thanks for taking the time to read and hopefully reply :)

Edit. Paging @QuantumBadger are you able to help?

Rub-z avatar Sep 25 '20 10:09 Rub-z

@Rub-z There are two major parts to implementing this, which are:

  1. Make some suitable UI to set the preference
  2. Filter posts before they're displayed based on that preference

(2) is fairly easy, the relevant class is PostListingFragment. Care needs to be taken to make sure this doesn't break related features like blocking subreddits or restricting post count.

https://github.com/QuantumBadger/RedReader/blob/master/src/main/java/org/quantumbadger/redreader/fragments/PostListingFragment.java

In terms of the UI, it would be good to have a list where you can add/edit/delete entries, similar to the following random example off Google Images :)

movie-list-android-56b754978fce492ea4882557e03fa8bf4402ed2036ea80d056b60e6c0e0b339c

Relevant files are:

https://github.com/QuantumBadger/RedReader/blob/master/src/main/res/xml/prefs_behaviour.xml

https://github.com/QuantumBadger/RedReader/blob/master/src/main/java/org/quantumbadger/redreader/common/PrefsUtility.java

https://github.com/QuantumBadger/RedReader/blob/master/src/main/java/org/quantumbadger/redreader/settings/SettingsFragment.java

If you have any questions let me know :)

QuantumBadger avatar Sep 26 '20 13:09 QuantumBadger

Hi QuantumBadger!

Many thanks for the insights :)

I'd worked out that the PostListingFragment was key but this additional information is brilliant!

In regards to (1) the UI, is Settings > Behaviour > Posts a good place?

Another option, 'Post Filtering', could be added which would direct you to a list of strings as per your image.

I won't be able to properly look at the codebase until next week but will definitely take you up on any offer of advice for sure when I do!

Many thanks for replying :)

Rub-z avatar Sep 26 '20 16:09 Rub-z

No problem :) Thanks for looking into implementing this!

In regards to (1) the UI, is Settings > Behaviour > Posts a good place?

Another option, 'Post Filtering', could be added which would direct you to a list of strings as per your image.

Yep, that sounds good to me.

QuantumBadger avatar Sep 27 '20 10:09 QuantumBadger

No problem :) Thanks for looking into implementing this!

In regards to (1) the UI, is Settings > Behaviour > Posts a good place? Another option, 'Post Filtering', could be added which would direct you to a list of strings as per your image.

Yep, that sounds good to me.

Hi @QuantumBadger

Sorry for taking so long to get around to this...

I have pretty much done what we discussed except I ran into a couple of issues and didn't want to mess up the code so kept it simple... My main computer packed in so the only way for me to debug the code was installing the apk on the phone :/

Hopefully this is 95% done and you can take the files I've provided and merge (once you've taken a look and made any required changes).

So the list 'Keyword Filter List' has just been implemented as comma separeted Preference string:

image

image

This is working correctly.

However the post filtering is not working (I don't think the post.name is the 'Post Title'). Perhaps you could take a look?

image

Please find the attached the files I've made changes to:

image

changes.zip

ZIP password is 'redreader'

Cheers.

Rub-z avatar Nov 03 '20 18:11 Rub-z

Has this made it through into the development version? I'd like something where I can filter, ideally by regex, on the body of the post, but a filter by title should be easier to extend.

pseudomonas avatar Sep 17 '21 12:09 pseudomonas

Any progress on this? Need ability to hide posts by keyword, hide posts with certain flair in subreddits, hide users

thereddestdog avatar Jul 14 '23 02:07 thereddestdog