diff options
author | Minijackson <minijackson@riseup.net> | 2018-08-22 13:45:49 +0200 |
---|---|---|
committer | Minijackson <minijackson@riseup.net> | 2018-08-22 13:45:49 +0200 |
commit | de5bd0955ac50fe17aaf0a02055cc70836b7e4ae (patch) | |
tree | 56ce0cd679367a60ba3a706ac4d207bc9cc82230 /common/storage/entitystore.cpp | |
parent | 2a8abb5970f0f444e36bbd94cd527522c7246def (diff) | |
download | sink-de5bd0955ac50fe17aaf0a02055cc70836b7e4ae.tar.gz sink-de5bd0955ac50fe17aaf0a02055cc70836b7e4ae.zip |
Fix "contains" function + write tests for contains and existsseparate-uid
Diffstat (limited to 'common/storage/entitystore.cpp')
-rw-r--r-- | common/storage/entitystore.cpp | 5 |
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 | ||
633 | bool EntityStore::contains(const QByteArray &type, const QByteArray &uid) | 633 | bool 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 | ||
640 | bool EntityStore::exists(const QByteArray &type, const QByteArray &uid) | 639 | bool EntityStore::exists(const QByteArray &type, const QByteArray &uid) |