-
-
Notifications
You must be signed in to change notification settings - Fork 881
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
feat(filteReddit): do not filter own posts #3545
feat(filteReddit): do not filter own posts #3545
Conversation
Added an option to the filteReddit module to prevent filtering of own posts unless explicitly disabled.
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.
A few small fixes and this looks great, thanks for contributing!
@@ -59,6 +59,11 @@ module.options = { | |||
noconfig: process.env.BUILD_TARGET === 'safari' || process.env.BUILD_TARGET === 'edge', | |||
description: 'Show a \'filter visited links\' tab at the top of each subreddit, to easily toggle whether to filter visited posts.', | |||
}, | |||
exludeOwnPosts: { |
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.
Exclude -- spelling
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.
Silly me!
const postAuthor = thing.getAuthor().toLowerCase(); | ||
// No standard marker for my own posts so compare against the logged in user | ||
const myName = loggedInUser(); | ||
if (myName && (myName.trim().toLowerCase() === postAuthor)) { |
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 think trim is overkill in this case.
@@ -827,6 +832,16 @@ function scanEntries(ele) { | |||
const postFlair = thing.getPostFlairText(); | |||
const postLink = thing.getPostLink(); | |||
|
|||
// Do not apply any other filters if posts belong to me |
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.
How about moving this above const postTitle
, so the function can quit as early as possible?
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.
Sounds good.
Move the conditional up to exit the filter loop as early as possible.
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.
Not yet tested
Looks good, thanks! |
Added an option to the filteReddit module to prevent filtering of own posts unless explicitly disabled.
Closes #3018