Use RSS feed update time as a fallback

Some sites omit publication date in its RSS feed articles
that prevents "Ignore Subsequent Matches" to work properly.
Closes #8959.
This commit is contained in:
Vladimir Golovnev (Glassez) 2018-05-21 12:21:54 +03:00
parent 1b14706b08
commit 9b80c4f7eb
No known key found for this signature in database
GPG key ID: 52A2C7DEE2DFA6F7
2 changed files with 24 additions and 5 deletions

View file

@ -212,7 +212,13 @@ void Feed::handleParsingFinished(const RSS::Private::ParsingResult &result)
m_lastBuildDate = result.lastBuildDate;
int newArticlesCount = 0;
for (const QVariantHash &varHash : result.articles) {
const QDateTime now {QDateTime::currentDateTime()};
for (QVariantHash varHash : result.articles) {
// if article has no publication date we use feed update time as a fallback
QVariant &articleDate = varHash[Article::KeyDate];
if (!articleDate.toDateTime().isValid())
articleDate = now;
try {
auto article = new Article(this, varHash);
if (addArticle(article))