Also process msg filters when some other actions are taken: e.g. removed assigned feed/account etc.
This commit is contained in:
parent
2e04963acc
commit
5d4c4dd1d9
@ -767,10 +767,11 @@ bool DatabaseQueries::deleteAccount(const QSqlDatabase& db, int account_id) {
|
|||||||
query.setForwardOnly(true);
|
query.setForwardOnly(true);
|
||||||
QStringList queries;
|
QStringList queries;
|
||||||
|
|
||||||
queries << QSL("DELETE FROM Messages WHERE account_id = :account_id;") <<
|
queries << QSL("DELETE FROM Messages WHERE account_id = :account_id;")
|
||||||
QSL("DELETE FROM Feeds WHERE account_id = :account_id;") <<
|
<< QSL("DELETE FROM Feeds WHERE account_id = :account_id;")
|
||||||
QSL("DELETE FROM Categories WHERE account_id = :account_id;") <<
|
<< QSL("DELETE FROM Categories WHERE account_id = :account_id;")
|
||||||
QSL("DELETE FROM Accounts WHERE id = :account_id;");
|
<< QSL("DELETE FROM MessageFiltersInFeeds WHERE account_id = :account_id;")
|
||||||
|
<< QSL("DELETE FROM Accounts WHERE id = :account_id;");
|
||||||
|
|
||||||
for (const QString& q : queries) {
|
for (const QString& q : queries) {
|
||||||
query.prepare(q);
|
query.prepare(q);
|
||||||
@ -1198,7 +1199,15 @@ bool DatabaseQueries::deleteFeed(const QSqlDatabase& db, int feed_custom_id, int
|
|||||||
|
|
||||||
q.setForwardOnly(true);
|
q.setForwardOnly(true);
|
||||||
|
|
||||||
// Remove all messages from this feed.
|
// Remove all messages and other data from this feed.
|
||||||
|
q.prepare(QSL("DELETE FROM MessageFiltersInFeeds WHERE feed_custom_id = :feed AND account_id = :account_id;"));
|
||||||
|
q.bindValue(QSL(":feed"), feed_custom_id);
|
||||||
|
q.bindValue(QSL(":account_id"), account_id);
|
||||||
|
|
||||||
|
if (!q.exec()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
q.prepare(QSL("DELETE FROM Messages WHERE feed = :feed AND account_id = :account_id;"));
|
q.prepare(QSL("DELETE FROM Messages WHERE feed = :feed AND account_id = :account_id;"));
|
||||||
q.bindValue(QSL(":feed"), feed_custom_id);
|
q.bindValue(QSL(":feed"), feed_custom_id);
|
||||||
q.bindValue(QSL(":account_id"), account_id);
|
q.bindValue(QSL(":account_id"), account_id);
|
||||||
|
@ -298,6 +298,8 @@ void ServiceRoot::syncIn() {
|
|||||||
RootItem* new_tree = obtainNewTreeForSyncIn();
|
RootItem* new_tree = obtainNewTreeForSyncIn();
|
||||||
|
|
||||||
if (new_tree != nullptr) {
|
if (new_tree != nullptr) {
|
||||||
|
// TODO: Store msg filter assignments and then restore it and
|
||||||
|
// also remove any leftover assignments.
|
||||||
QMap<QString, QVariant> feed_custom_data = storeCustomFeedsData();
|
QMap<QString, QVariant> feed_custom_data = storeCustomFeedsData();
|
||||||
|
|
||||||
// Remove from feeds model, then from SQL but leave messages intact.
|
// Remove from feeds model, then from SQL but leave messages intact.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user