Skip to content

Commit

Permalink
feat(filteReddit): do not filter own posts (honestbleeps#3545)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssonal authored and benmcgarry committed Nov 4, 2016
1 parent 42e6b11 commit b8ee85f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/modules/filteReddit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
},
excludeOwnPosts: {
type: 'boolean',
value: true,
description: 'Don\'t filter your own posts',
},
excludeCommentsPage: {
type: 'boolean',
value: true,
Expand Down Expand Up @@ -822,6 +827,16 @@ function scanEntries(ele) {
things.forEach(thing => {
let postSubreddit, currSub;
if (thing.isPost() && !onSavedPage) {
// Do not apply any other filters if posts belong to me
if (module.options.excludeOwnPosts.value) {
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.toLowerCase() === postAuthor)) {
return;
}
}

const postTitle = thing.getTitle();
const postDomain = thing.getPostDomain();
const postFlair = thing.getPostFlairText();
Expand Down

0 comments on commit b8ee85f

Please sign in to comment.