mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-18 20:01:15 +01:00
Fixed bug with left over messages.
This commit is contained in:
parent
55dadfe238
commit
04d2b1392d
@ -17,6 +17,7 @@ Changed:
|
||||
|
||||
Fixed:
|
||||
|
||||
▪ Left over messages are now correctly deleted after sync-in is performed in TT-RSS account.
|
||||
▪ Made some rather big changes to sorting/filtering of feeds, which is now dynamic.
|
||||
▪ Feeds are now (re)sorted when batch update finishes. (bug #150)
|
||||
▪ Expand status if items in feed list are now persistent when performing sync-in of TT-RSS accounts. (bug #149)
|
||||
|
@ -587,6 +587,10 @@ void TtRssServiceRoot::syncIn() {
|
||||
// set primary IDs of the items.
|
||||
storeNewFeedTree(new_tree);
|
||||
|
||||
// We have new feed, some feeds were maybe removed,
|
||||
// so remove left over messages.
|
||||
removeLeftOverMessages();
|
||||
|
||||
foreach (RootItem *top_level_item, new_tree->childItems()) {
|
||||
top_level_item->setParent(NULL);
|
||||
requestItemReassignment(top_level_item, this);
|
||||
@ -669,6 +673,20 @@ void TtRssServiceRoot::removeOldFeedTree(bool including_messages) {
|
||||
}
|
||||
}
|
||||
|
||||
void TtRssServiceRoot::removeLeftOverMessages() {
|
||||
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
|
||||
QSqlQuery query(database);
|
||||
int account_id = accountId();
|
||||
|
||||
query.setForwardOnly(true);
|
||||
query.prepare(QSL("DELETE FROM Messages WHERE account_id = :account_id AND feed NOT IN (SELECT custom_id FROM Feeds WHERE account_id = :account_id);"));
|
||||
query.bindValue(QSL(":account_id"), account_id);
|
||||
|
||||
if (!query.exec()) {
|
||||
qWarning("Removing of left over messages failed: '%s'.", qPrintable(query.lastError().text()));
|
||||
}
|
||||
}
|
||||
|
||||
void TtRssServiceRoot::cleanAllItems() {
|
||||
foreach (RootItem *top_level_item, childItems()) {
|
||||
if (top_level_item->kind() != RootItemKind::Bin) {
|
||||
|
@ -99,6 +99,7 @@ class TtRssServiceRoot : public ServiceRoot {
|
||||
QStringList textualFeedIds(const QList<Feed*> &feeds);
|
||||
|
||||
void removeOldFeedTree(bool including_messages);
|
||||
void removeLeftOverMessages();
|
||||
void cleanAllItems();
|
||||
void storeNewFeedTree(RootItem *root);
|
||||
void loadFromDatabase();
|
||||
|
Loading…
Reference in New Issue
Block a user