Fix self counting as read message

This commit is contained in:
Nicolas Werner 2020-05-04 00:56:30 +02:00
parent 0c73c74574
commit a8b22e49c3

View file

@ -887,6 +887,7 @@ void
Cache::saveState(const mtx::responses::Sync &res) Cache::saveState(const mtx::responses::Sync &res)
{ {
using namespace mtx::events; using namespace mtx::events;
auto user_id = this->localUserId_.toStdString();
auto txn = lmdb::txn::begin(env_); auto txn = lmdb::txn::begin(env_);
@ -960,8 +961,10 @@ Cache::saveState(const mtx::responses::Sync &res)
if (!room.second.ephemeral.receipts.empty()) { if (!room.second.ephemeral.receipts.empty()) {
std::vector<QString> receipts; std::vector<QString> receipts;
for (const auto &receipt : room.second.ephemeral.receipts) for (const auto &receipt : room.second.ephemeral.receipts)
receipts.push_back(QString::fromStdString(receipt.first)); if (receipt.first != user_id)
emit newReadReceipts(QString::fromStdString(room.first), receipts); receipts.push_back(QString::fromStdString(receipt.first));
if (!receipts.empty())
emit newReadReceipts(QString::fromStdString(room.first), receipts);
} }
readStatus.emplace(QString::fromStdString(room.first), readStatus.emplace(QString::fromStdString(room.first),
calculateRoomReadStatus(room.first)); calculateRoomReadStatus(room.first));