Verified Commit 8e7be806 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Workaround broken Tag parentID in notifications

Invalid Tag has ID -1, but we store invalid parent in the DB as NULL
which gets auto-translated to 0 by our generated Entity code. To
work around that limitation we explicitly convert parent 0 to -1
when serializing Tag into response.

In the long run we need some proper fix, likely on the level of the
generated Entities.
parent 3870f6e7
......@@ -220,7 +220,14 @@ Protocol::FetchTagsResponse HandlerHelper::fetchTagsResponse(const Tag &tag,
// FIXME FIXME FIXME Terrible hack to workaround limitations of the generated entities code:
// The invalid parent is represented in code by -1 but in the DB it is stored as NULL, which
// gets converted to 0 by our entities code.
if (tag.parentId() == 0) {
} else {
if (tagFetchScope.fetchRemoteID() && connection) {
// Fail silently if retrieving tag RID is not allowed in current context
......@@ -460,6 +460,7 @@ void NotificationCollector::tagNotification(Protocol::TagChangeNotification::Ope
Protocol::FetchTagsResponse msgTag;
if (auto mgr = mAkonadi.notificationManager()) {
auto fetchScope = mgr->tagFetchScope();
if (!fetchScope->fetchIdOnly() && msgTag.gid().isEmpty()) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment