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

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
BillCarsonFr committed Jun 28, 2022
1 parent 8439796 commit 8fa47e5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/DecryptionFailureTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.yarn lint
*/

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

public eventDecrypted(e: MatrixEvent, err: DecryptionError): void {
// for now we only track megolm decrytion failures
if (e.event.content?.algorithm != "m.megolm.v1.aes-sha2") {
return
if (e.getWireContent().algorithm != "m.megolm.v1.aes-sha2") {
return;
}
if (err) {
this.addDecryptionFailure(new DecryptionFailure(e.getId(), err.code));
Expand Down
3 changes: 2 additions & 1 deletion src/components/structures/MatrixChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ import 'focus-visible';
// what-input helps improve keyboard accessibility
import 'what-input';

import { DecryptionError } from 'matrix-js-sdk/src/crypto/algorithms';

import PosthogTrackers from '../../PosthogTrackers';
import { DecryptionFailureTracker } from "../../DecryptionFailureTracker";
import { IMatrixClientCreds, MatrixClientPeg } from "../../MatrixClientPeg";
Expand Down Expand Up @@ -130,7 +132,6 @@ import { SnakedObject } from "../../utils/SnakedObject";
import { leaveRoomBehaviour } from "../../utils/leave-behaviour";
import VideoChannelStore from "../../stores/VideoChannelStore";
import { IRoomStateEventsActionPayload } from "../../actions/MatrixActionCreators";
import { DecryptionError } from 'matrix-js-sdk/src/crypto/algorithms';

// legacy export
export { default as Views } from "../../Views";
Expand Down
4 changes: 2 additions & 2 deletions test/DecryptionFailureTracker-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ function createFailedDecryptionEvent() {
const event = new MatrixEvent({
event_id: "event-id-" + Math.random().toString(16).slice(2),
content: {
algorithm : "m.megolm.v1.aes-sha2"
}
algorithm: "m.megolm.v1.aes-sha2",
},
});
event.setClearData(event.badEncryptedMessage(":("));
return event;
Expand Down

0 comments on commit 8fa47e5

Please sign in to comment.