Skip to content

Commit

Permalink
jesus add forgotten account_id restriction to cleaning feature
Browse files Browse the repository at this point in the history
  • Loading branch information
martinrotter committed Jan 23, 2024
1 parent f2b59b2 commit a975714
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/librssguard/database/databasequeries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ bool DatabaseQueries::removeUnwantedArticlesFromFeed(const QSqlDatabase& db,
q.prepare(QSL("SELECT Messages.date_created "
"FROM Messages "
"WHERE "
" Messages.account_id = :account_id AND "
" Messages.feed = :feed AND "
" Messages.is_deleted = 0 AND "
" Messages.is_pdeleted = 0 "
Expand All @@ -580,6 +581,7 @@ bool DatabaseQueries::removeUnwantedArticlesFromFeed(const QSqlDatabase& db,

q.bindValue(QSL(":offset"), amount_to_keep - 1);
q.bindValue(QSL(":feed"), feed->customId());
q.bindValue(QSL(":account_id"), feed->getParentServiceRoot()->accountId());

if (!q.exec()) {
throw ApplicationException(q.lastError().text());
Expand All @@ -596,6 +598,7 @@ bool DatabaseQueries::removeUnwantedArticlesFromFeed(const QSqlDatabase& db,
q.prepare(QSL("UPDATE Messages "
"SET is_deleted = 1 "
"WHERE "
" Messages.account_id = :account_id AND "
" Messages.feed = :feed AND "
" Messages.is_deleted = 0 AND "
" Messages.is_pdeleted = 0 AND "
Expand All @@ -607,6 +610,7 @@ bool DatabaseQueries::removeUnwantedArticlesFromFeed(const QSqlDatabase& db,
// We purge all older articles.
q.prepare(QSL("DELETE FROM Messages "
"WHERE "
" Messages.account_id = :account_id AND "
" Messages.feed = :feed AND "
" (Messages.is_deleted = 1 OR Messages.is_important != :is_important) AND "
" (Messages.is_deleted = 1 OR Messages.is_read != :is_read) AND "
Expand All @@ -617,6 +621,7 @@ bool DatabaseQueries::removeUnwantedArticlesFromFeed(const QSqlDatabase& db,
q.bindValue(QSL(":is_read"), dont_remove_unread ? 0 : 2);
q.bindValue(QSL(":feed"), feed->customId());
q.bindValue(QSL(":stamp"), last_kept_stamp);
q.bindValue(QSL(":account_id"), feed->getParentServiceRoot()->accountId());

if (!q.exec()) {
throw ApplicationException(q.lastError().text());
Expand Down

0 comments on commit a975714

Please sign in to comment.