From 4e2d9c28f5347ac184492cf6ec6ac5433e492ba2 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Wed, 4 Nov 2020 17:21:25 +0000
Subject: [PATCH] Convert EncryptionEvent to Typescript
---
.../views/messages/EncryptionEvent.js | 56 -------------------
.../views/messages/EncryptionEvent.tsx | 54 ++++++++++++++++++
2 files changed, 54 insertions(+), 56 deletions(-)
delete mode 100644 src/components/views/messages/EncryptionEvent.js
create mode 100644 src/components/views/messages/EncryptionEvent.tsx
diff --git a/src/components/views/messages/EncryptionEvent.js b/src/components/views/messages/EncryptionEvent.js
deleted file mode 100644
index ee304b4fa3..0000000000
--- a/src/components/views/messages/EncryptionEvent.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-Copyright 2020 The Matrix.org Foundation C.I.C.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-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.
-*/
-
-import React from 'react';
-import PropTypes from 'prop-types';
-import { _t } from '../../../languageHandler';
-import { MatrixClientPeg } from '../../../MatrixClientPeg';
-import EventTileBubble from "./EventTileBubble";
-
-export default class EncryptionEvent extends React.Component {
- render() {
- const {mxEvent} = this.props;
-
- const isRoomEncrypted = MatrixClientPeg.get().isRoomEncrypted(mxEvent.getRoomId());
- if (mxEvent.getContent().algorithm === 'm.megolm.v1.aes-sha2' && isRoomEncrypted) {
- return ;
- } else if (isRoomEncrypted) {
- return ;
- }
-
- return ;
- }
-}
-
-EncryptionEvent.propTypes = {
- /* the MatrixEvent to show */
- mxEvent: PropTypes.object.isRequired,
-};
diff --git a/src/components/views/messages/EncryptionEvent.tsx b/src/components/views/messages/EncryptionEvent.tsx
new file mode 100644
index 0000000000..9a6af9446f
--- /dev/null
+++ b/src/components/views/messages/EncryptionEvent.tsx
@@ -0,0 +1,54 @@
+/*
+Copyright 2020 The Matrix.org Foundation C.I.C.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+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.
+*/
+
+import React from 'react';
+import {MatrixEvent} from "matrix-js-sdk/src/models/event";
+
+import { _t } from '../../../languageHandler';
+import { MatrixClientPeg } from '../../../MatrixClientPeg';
+import EventTileBubble from "./EventTileBubble";
+
+interface IProps {
+ mxEvent: MatrixEvent;
+}
+
+const EncryptionEvent: React.FC = ({mxEvent}) => {
+ const isRoomEncrypted = MatrixClientPeg.get().isRoomEncrypted(mxEvent.getRoomId());
+ if (mxEvent.getContent().algorithm === 'm.megolm.v1.aes-sha2' && isRoomEncrypted) {
+ return ;
+ } else if (isRoomEncrypted) {
+ return ;
+ }
+
+ return ;
+}
+
+export default EncryptionEvent;