mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Show only messages in room list
This commit is contained in:
parent
91d1f19058
commit
562169965c
1 changed files with 30 additions and 7 deletions
|
@ -552,17 +552,40 @@ TimelineModel::addEvents(const mtx::responses::Timeline &timeline)
|
||||||
updateLastMessage();
|
updateLastMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
auto
|
||||||
|
isMessage(const mtx::events::RoomEvent<T> &e)
|
||||||
|
-> std::enable_if_t<std::is_same<decltype(e.content.msgtype), std::string>::value, bool>
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
auto
|
||||||
|
isMessage(const mtx::events::Event<T> &)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineModel::updateLastMessage()
|
TimelineModel::updateLastMessage()
|
||||||
{
|
{
|
||||||
auto event = events.value(eventOrder.back());
|
for (auto it = eventOrder.rbegin(); it != eventOrder.rend(); ++it) {
|
||||||
if (auto e = boost::get<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(&event)) {
|
auto event = events.value(*it);
|
||||||
event = decryptEvent(*e).event;
|
if (auto e = boost::get<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(
|
||||||
}
|
&event)) {
|
||||||
|
event = decryptEvent(*e).event;
|
||||||
|
}
|
||||||
|
|
||||||
auto description = utils::getMessageDescription(
|
if (!boost::apply_visitor([](const auto &e) -> bool { return isMessage(e); },
|
||||||
event, QString::fromStdString(http::client()->user_id().to_string()), room_id_);
|
event))
|
||||||
emit manager_->updateRoomsLastMessage(room_id_, description);
|
continue;
|
||||||
|
|
||||||
|
auto description = utils::getMessageDescription(
|
||||||
|
event, QString::fromStdString(http::client()->user_id().to_string()), room_id_);
|
||||||
|
emit manager_->updateRoomsLastMessage(room_id_, description);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<QString>
|
std::vector<QString>
|
||||||
|
|
Loading…
Reference in a new issue