summaryrefslogtreecommitdiffstats
path: root/common/storage
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2018-08-22 13:45:49 +0200
committerMinijackson <minijackson@riseup.net>2018-08-22 13:45:49 +0200
commitde5bd0955ac50fe17aaf0a02055cc70836b7e4ae (patch)
tree56ce0cd679367a60ba3a706ac4d207bc9cc82230 /common/storage
parent2a8abb5970f0f444e36bbd94cd527522c7246def (diff)
downloadsink-separate-uid.tar.gz
sink-separate-uid.zip
Fix "contains" function + write tests for contains and existsseparate-uid
Diffstat (limited to 'common/storage')
-rw-r--r--common/storage/entitystore.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/common/storage/entitystore.cpp b/common/storage/entitystore.cpp
index a92de40..454e25a 100644
--- a/common/storage/entitystore.cpp
+++ b/common/storage/entitystore.cpp
@@ -630,11 +630,10 @@ void EntityStore::readAllUids(const QByteArray &type, const std::function<void(c
630 DataStore::getUids(type, d->getTransaction(), callback); 630 DataStore::getUids(type, d->getTransaction(), callback);
631} 631}
632 632
633bool EntityStore::contains(const QByteArray &type, const QByteArray &uid) 633bool EntityStore::contains(const QByteArray & /* type */, const QByteArray &uid)
634{ 634{
635 Q_ASSERT(!uid.isEmpty()); 635 Q_ASSERT(!uid.isEmpty());
636 const auto internalUid = Identifier::fromDisplayByteArray(uid).toInternalByteArray(); 636 return !DataStore::getRevisionsFromUid(d->getTransaction(), uid).isEmpty();
637 return DataStore::mainDatabase(d->getTransaction(), type).contains(internalUid);
638} 637}
639 638
640bool EntityStore::exists(const QByteArray &type, const QByteArray &uid) 639bool EntityStore::exists(const QByteArray &type, const QByteArray &uid)