-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Added Specific ignoreOlderThan value (override) per URL Feature #3429
base: develop
Are you sure you want to change the base?
Conversation
it would be easier to add the variables for each feed and then use a function that returned the feed value or the default if not specified and use that function instead of the direct value access in the genersteFeed function |
…de a function that returned values from the feed
Hello, |
@@ -5,7 +5,9 @@ Module.register("newsfeed", { | |||
{ | |||
title: "New York Times", | |||
url: "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml", | |||
encoding: "UTF-8" //ISO-8859-1 | |||
encoding: "UTF-8", //ISO-8859-1 | |||
ignoreOldItems: false, |
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.
Rather than having ignorOldItems and ignorOlderThan be global parameters, I added them inside the feed array and gave then default values of false and 1day.
@@ -176,19 +180,23 @@ Module.register("newsfeed", { | |||
}); | |||
} | |||
}, | |||
|
|||
getFeedProperty(feed, property) { |
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 added this function so you can access values inside the objects in the feed array.
for (let item of feedItems) { | ||
item.sourceTitle = this.titleForFeed(feed); | ||
if (!(this.config.ignoreOldItems && Date.now() - new Date(item.pubdate) > this.config.ignoreOlderThan)) { | ||
let ignoreOldItems = getFeedProperty(feedItems, 'ignoreOldItems'); |
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 changed how the the variables are accessed when trying to display the feed by using the getFeedProperty()
hi @AartiPhatke thanks for your patience. Could you adress the styling issues that github shows in the files tab? And also update your branch to the latest develop so the tests run through again? |
Hello,
I added the feature request in the newsfeed module for being able to set ignoreOlderThan for each newsfeed rather than have a global variable for it, see: #3360
To do this however, instead of adding an ignoreOlderThanOveride parameter, I changed ignoreOldItems and ignoreOlderThan to be arrays so they can hold values for each news feed. I also changed the logic for how these variables are accessed in generateFeed(). I also ran 'npm run test' and some of the unit tests for the calendar module were failing, I don't think this is related to my PR but I wanted to mention it.
Hope this helps!