mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
There was always supposed to be a failed state for events
This commit is contained in:
parent
3507698ea5
commit
ba56c9f408
2 changed files with 11 additions and 4 deletions
|
@ -698,7 +698,8 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r
|
||||||
return QVariant(QString::fromStdString(event_id(event)));
|
return QVariant(QString::fromStdString(event_id(event)));
|
||||||
}
|
}
|
||||||
case State: {
|
case State: {
|
||||||
auto id = QString::fromStdString(event_id(event));
|
auto idstr = event_id(event);
|
||||||
|
auto id = QString::fromStdString(idstr);
|
||||||
auto containsOthers = [](const auto &vec) {
|
auto containsOthers = [](const auto &vec) {
|
||||||
for (const auto &e : vec)
|
for (const auto &e : vec)
|
||||||
if (e.second != http::client()->user_id().to_string())
|
if (e.second != http::client()->user_id().to_string())
|
||||||
|
@ -709,9 +710,13 @@ TimelineModel::data(const mtx::events::collections::TimelineEvents &event, int r
|
||||||
// only show read receipts for messages not from us
|
// only show read receipts for messages not from us
|
||||||
if (acc::sender(event) != http::client()->user_id().to_string())
|
if (acc::sender(event) != http::client()->user_id().to_string())
|
||||||
return qml_mtx_events::Empty;
|
return qml_mtx_events::Empty;
|
||||||
else if (!id.isEmpty() && id[0] == 'm')
|
else if (!id.isEmpty() && id[0] == 'm') {
|
||||||
return qml_mtx_events::Sent;
|
auto pending = cache::client()->pendingEvents(this->room_id_.toStdString());
|
||||||
else if (read.contains(id) || containsOthers(cache::readReceipts(id, room_id_)))
|
if (std::find(pending.begin(), pending.end(), idstr) != pending.end())
|
||||||
|
return qml_mtx_events::Sent;
|
||||||
|
else
|
||||||
|
return qml_mtx_events::Failed;
|
||||||
|
} else if (read.contains(id) || containsOthers(cache::readReceipts(id, room_id_)))
|
||||||
return qml_mtx_events::Read;
|
return qml_mtx_events::Read;
|
||||||
else
|
else
|
||||||
return qml_mtx_events::Received;
|
return qml_mtx_events::Received;
|
||||||
|
|
|
@ -149,6 +149,8 @@ enum EventState
|
||||||
Read,
|
Read,
|
||||||
//! The client sent the message. Not yet received.
|
//! The client sent the message. Not yet received.
|
||||||
Sent,
|
Sent,
|
||||||
|
//! The client sent the message, but it failed.
|
||||||
|
Failed,
|
||||||
//! When the message is loaded from cache or backfill.
|
//! When the message is loaded from cache or backfill.
|
||||||
Empty,
|
Empty,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue