From d55ad2dbea33adc0690160dcaa7d8bc87de35d9d Mon Sep 17 00:00:00 2001 From: Andy Uhnak Date: Mon, 3 Apr 2023 17:30:05 +0100 Subject: [PATCH] No event decoration if no decryption result --- .../Models/Room/MXKRoomBubbleComponent.m | 21 ++++++++++++------- .../MXKEncryptionInfoView.m | 3 ++- changelog.d/pr-7471.bugfix | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 changelog.d/pr-7471.bugfix diff --git a/Riot/Modules/MatrixKit/Models/Room/MXKRoomBubbleComponent.m b/Riot/Modules/MatrixKit/Models/Room/MXKRoomBubbleComponent.m index 30b3da9f1..d048d75a8 100644 --- a/Riot/Modules/MatrixKit/Models/Room/MXKRoomBubbleComponent.m +++ b/Riot/Modules/MatrixKit/Models/Room/MXKRoomBubbleComponent.m @@ -204,14 +204,21 @@ // The encryption is in a good state. // Only show a warning badge if there are decryption trust issues. - switch (event.decryptionDecoration.color) + if (event.decryptionDecoration) { - case MXEventDecryptionDecorationColorRed: - return EventEncryptionDecorationRed; - case MXEventDecryptionDecorationColorGrey: - return EventEncryptionDecorationGrey; - case MXEventDecryptionDecorationColorNone: - return EventEncryptionDecorationNone; + switch (event.decryptionDecoration.color) + { + case MXEventDecryptionDecorationColorNone: + return EventEncryptionDecorationNone; + case MXEventDecryptionDecorationColorGrey: + return EventEncryptionDecorationGrey; + case MXEventDecryptionDecorationColorRed: + return EventEncryptionDecorationRed; + } + } + else + { + return EventEncryptionDecorationNone; } } diff --git a/Riot/Modules/MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.m b/Riot/Modules/MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.m index eb7db5bb1..0c4adcd15 100644 --- a/Riot/Modules/MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.m +++ b/Riot/Modules/MatrixKit/Views/EncryptionInfoView/MXKEncryptionInfoView.m @@ -196,7 +196,8 @@ static NSAttributedString *verticalWhitespace = nil; if (!safetyMessage) { // Use default copy if none is provided by the decryption decoration - safetyMessage = _mxEvent.decryptionDecoration.color != MXEventDecryptionDecorationColorNone ? [VectorL10n roomEventEncryptionInfoKeyAuthenticityNotGuaranteed] : [VectorL10n userVerificationSessionsListSessionTrusted]; + BOOL isUntrusted = _mxEvent.decryptionDecoration && _mxEvent.decryptionDecoration.color != MXEventDecryptionDecorationColorNone; + safetyMessage = isUntrusted ? [VectorL10n roomEventEncryptionInfoKeyAuthenticityNotGuaranteed] : [VectorL10n userVerificationSessionsListSessionTrusted]; } NSString *decryptionError; diff --git a/changelog.d/pr-7471.bugfix b/changelog.d/pr-7471.bugfix new file mode 100644 index 000000000..1e859c16a --- /dev/null +++ b/changelog.d/pr-7471.bugfix @@ -0,0 +1 @@ +Timeline: No event decoration if no decryption result