Skip to content

Article Filter: How can I remove Articles that are not in my whitelist? #987

Answered by Mitecon
Crehet asked this question in Q&A
Discussion options

You must be logged in to vote

It's helpful to think of it in terms of:

I want 'this' AND NOT 'that' ELSE ignore everything else.

So you want to allow 'firefox' but not 'firefox-developer-edition' and ignore everything else.

However, you've got Accept and Ignore the wrong way round:

    return MessageObject.Ignore;
   }
   else {
   return MessageObject.Accept;

This is because you want to run actions on the conditions and then ignore everything else.

So we swap those:

    return MessageObject.Accept;
   }
   else {
   return MessageObject.Ignore;

Now onto the IF statement:

  if (whitelist.some(i => msg.title.indexOf(i) != -1)) {
   if (blacklist.some(i => msg.title.indexOf(i) != -1)) {

Remember, you're looking for:

I…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@Crehet
Comment options

@Crehet
Comment options

Answer selected by Crehet
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants