Fix preview of sent encrypted images

remotes/origin/0.7.0-dev
Nicolas Werner 5 years ago
parent db4a316b56
commit 9c1912ed93
  1. 9
      src/timeline/TimelineModel.cpp

@ -414,6 +414,7 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj
return eventCopy; return eventCopy;
}, },
ev); ev);
events.remove(txn_id); events.remove(txn_id);
events.insert(event_id, ev); events.insert(event_id, ev);
@ -666,7 +667,7 @@ TimelineModel::internalAddEvents(
const std::vector<mtx::events::collections::TimelineEvents> &timeline) const std::vector<mtx::events::collections::TimelineEvents> &timeline)
{ {
std::vector<QString> ids; std::vector<QString> ids;
for (const auto &e : timeline) { for (auto e : timeline) {
QString id = QString id =
boost::apply_visitor([](const auto &e) -> QString { return eventId(e); }, e); boost::apply_visitor([](const auto &e) -> QString { return eventId(e); }, e);
@ -707,16 +708,16 @@ TimelineModel::internalAddEvents(
if (auto event = if (auto event =
boost::get<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(&e)) { boost::get<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(&e)) {
auto temp = decryptEvent(*event).event; e = decryptEvent(*event).event;
}
auto encInfo = boost::apply_visitor( auto encInfo = boost::apply_visitor(
[](const auto &ev) -> boost::optional<mtx::crypto::EncryptedFile> { [](const auto &ev) -> boost::optional<mtx::crypto::EncryptedFile> {
return eventEncryptionInfo(ev); return eventEncryptionInfo(ev);
}, },
temp); e);
if (encInfo) if (encInfo)
emit newEncryptedImage(encInfo.value()); emit newEncryptedImage(encInfo.value());
}
this->events.insert(id, e); this->events.insert(id, e);
ids.push_back(id); ids.push_back(id);

Loading…
Cancel
Save