Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 8fa47e5

Browse files
committed
code review
1 parent 8439796 commit 8fa47e5

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/DecryptionFailureTracker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,
1212
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
14-
limitations under the License.
14+
limitations under the License.yarn lint
1515
*/
1616

1717
import { DecryptionError } from "matrix-js-sdk/src/crypto/algorithms";
@@ -131,8 +131,8 @@ export class DecryptionFailureTracker {
131131

132132
public eventDecrypted(e: MatrixEvent, err: DecryptionError): void {
133133
// for now we only track megolm decrytion failures
134-
if (e.event.content?.algorithm != "m.megolm.v1.aes-sha2") {
135-
return
134+
if (e.getWireContent().algorithm != "m.megolm.v1.aes-sha2") {
135+
return;
136136
}
137137
if (err) {
138138
this.addDecryptionFailure(new DecryptionFailure(e.getId(), err.code));

src/components/structures/MatrixChat.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ import 'focus-visible';
3838
// what-input helps improve keyboard accessibility
3939
import 'what-input';
4040

41+
import { DecryptionError } from 'matrix-js-sdk/src/crypto/algorithms';
42+
4143
import PosthogTrackers from '../../PosthogTrackers';
4244
import { DecryptionFailureTracker } from "../../DecryptionFailureTracker";
4345
import { IMatrixClientCreds, MatrixClientPeg } from "../../MatrixClientPeg";
@@ -130,7 +132,6 @@ import { SnakedObject } from "../../utils/SnakedObject";
130132
import { leaveRoomBehaviour } from "../../utils/leave-behaviour";
131133
import VideoChannelStore from "../../stores/VideoChannelStore";
132134
import { IRoomStateEventsActionPayload } from "../../actions/MatrixActionCreators";
133-
import { DecryptionError } from 'matrix-js-sdk/src/crypto/algorithms';
134135

135136
// legacy export
136137
export { default as Views } from "../../Views";

test/DecryptionFailureTracker-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ function createFailedDecryptionEvent() {
3030
const event = new MatrixEvent({
3131
event_id: "event-id-" + Math.random().toString(16).slice(2),
3232
content: {
33-
algorithm : "m.megolm.v1.aes-sha2"
34-
}
33+
algorithm: "m.megolm.v1.aes-sha2",
34+
},
3535
});
3636
event.setClearData(event.badEncryptedMessage(":("));
3737
return event;

0 commit comments

Comments
 (0)