Null check decoded messages in loadPinnedMessage
`decryptMessage` returns null if it fails to decode the passed message. This value
then got fed into `EventHandler::richBody` which logged a warning and cleared `m_pinnedMessage`.
If we instead retain the value as an `EncryptedEvent`, the UI will pin the encrypted event
placeholder instead of hiding the existence of pins.
(cherry picked from commit 71c84be4b4)
This commit is contained in:
committed by
Joshua Goins
parent
4371c3f7e5
commit
bc6e22bc6d
@@ -1181,7 +1181,10 @@ void NeoChatRoom::loadPinnedMessage()
|
||||
connection()->callApi<GetOneRoomEventJob>(id(), mostRecentEventId).then([this](const auto &job) {
|
||||
auto event = fromJson<event_ptr_tt<RoomEvent>>(job->jsonData());
|
||||
if (auto encEv = eventCast<EncryptedEvent>(event.get())) {
|
||||
event = decryptMessage(*encEv);
|
||||
auto decryptedMessage = decryptMessage(*encEv);
|
||||
if (decryptedMessage) {
|
||||
event = std::move(decryptedMessage);
|
||||
}
|
||||
}
|
||||
m_pinnedMessage = EventHandler::richBody(this, event.get());
|
||||
Q_EMIT pinnedMessageChanged();
|
||||
|
||||
Reference in New Issue
Block a user