mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-27 07:46:17 +01:00
fixup datetimes of messages from future
This commit is contained in:
parent
12ae03e9c5
commit
d4e4abfa84
@ -26,7 +26,7 @@
|
||||
<url type="donation">https://github.com/sponsors/martinrotter</url>
|
||||
<content_rating type="oars-1.1" />
|
||||
<releases>
|
||||
<release version="4.1.2" date="2022-02-24"/>
|
||||
<release version="4.1.2" date="2022-02-25"/>
|
||||
</releases>
|
||||
<content_rating type="oars-1.0">
|
||||
<content_attribute id="violence-cartoon">none</content_attribute>
|
||||
|
@ -99,6 +99,15 @@ void Message::sanitize(const Feed* feed) {
|
||||
m_url = base.resolved(m_url).toString();
|
||||
}
|
||||
}
|
||||
|
||||
// Fix datetimes in future.
|
||||
if (m_createdFromFeed && m_created.toUTC() > QDateTime::currentDateTimeUtc()) {
|
||||
qWarningNN << LOGSEC_CORE << "Fixing future date of article" << QUOTE_W_SPACE(m_title) << "from invalid date/time"
|
||||
<< QUOTE_W_SPACE_DOT(m_created);
|
||||
|
||||
m_createdFromFeed = false;
|
||||
m_created = QDateTime::currentDateTimeUtc();
|
||||
}
|
||||
}
|
||||
|
||||
Message Message::fromSqlRecord(const QSqlRecord& record, bool* result) {
|
||||
|
@ -190,6 +190,14 @@ void MessageObject::setCreated(const QDateTime& created) {
|
||||
m_message->m_created = created;
|
||||
}
|
||||
|
||||
bool MessageObject::createdIsMadeup() const {
|
||||
return !m_message->m_createdFromFeed;
|
||||
}
|
||||
|
||||
void MessageObject::setCreatedIsMadeup(bool madeup) {
|
||||
m_message->m_createdFromFeed = !madeup;
|
||||
}
|
||||
|
||||
bool MessageObject::isRead() const {
|
||||
return m_message->m_isRead;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ class MessageObject : public QObject {
|
||||
Q_PROPERTY(QString contents READ contents WRITE setContents)
|
||||
Q_PROPERTY(QString rawContents READ rawContents WRITE setRawContents)
|
||||
Q_PROPERTY(QDateTime created READ created WRITE setCreated)
|
||||
Q_PROPERTY(bool createdIsMadeup READ createdIsMadeup WRITE setCreatedIsMadeup)
|
||||
Q_PROPERTY(double score READ score WRITE setScore)
|
||||
Q_PROPERTY(bool isRead READ isRead WRITE setIsRead)
|
||||
Q_PROPERTY(bool isImportant READ isImportant WRITE setIsImportant)
|
||||
@ -123,6 +124,9 @@ class MessageObject : public QObject {
|
||||
QDateTime created() const;
|
||||
void setCreated(const QDateTime& created);
|
||||
|
||||
bool createdIsMadeup() const;
|
||||
void setCreatedIsMadeup(bool madeup);
|
||||
|
||||
bool isRead() const;
|
||||
void setIsRead(bool is_read);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user