Skip to content
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

Merged
merged 2 commits into from
Oct 24, 2016

Conversation

ssonal
Copy link
Contributor

@ssonal ssonal commented Oct 22, 2016

Added an option to the filteReddit module to prevent filtering of own posts unless explicitly disabled.

Closes #3018

Added an option to the filteReddit module to prevent filtering
of own posts unless explicitly disabled.
Copy link
Collaborator

@jewel-andraia jewel-andraia left a 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: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exclude -- spelling

Copy link
Contributor Author

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)) {
Copy link
Collaborator

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
Copy link
Collaborator

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?

Copy link
Contributor Author

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.
Copy link
Collaborator

@erikdesjardins erikdesjardins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet tested

@erikdesjardins erikdesjardins added this to the v5.1.0 milestone Oct 22, 2016
@erikdesjardins erikdesjardins merged commit 4b1406e into honestbleeps:master Oct 24, 2016
@erikdesjardins
Copy link
Collaborator

Looks good, thanks!

@ssonal ssonal deleted the fiteredit-enhancement branch October 25, 2016 00:48
benmcgarry pushed a commit to benmcgarry/Reddit-Enhancement-Suite that referenced this pull request Nov 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants