From 9706114bb571a903fd607838229717fe767fe465 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 22 Jan 2020 16:54:31 +0000 Subject: [PATCH] move E2E_STATE to E2EIcon to simplify imports --- src/components/views/rooms/E2EIcon.js | 18 +++++++++++++----- src/components/views/rooms/EventTile.js | 8 +------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/components/views/rooms/E2EIcon.js b/src/components/views/rooms/E2EIcon.js index 545d1fd7ed..6ee20023ff 100644 --- a/src/components/views/rooms/E2EIcon.js +++ b/src/components/views/rooms/E2EIcon.js @@ -14,22 +14,30 @@ See the License for the specific language governing permissions and limitations under the License. */ +import React from "react"; import classNames from 'classnames'; import { _t } from '../../../languageHandler'; import AccessibleButton from '../elements/AccessibleButton'; import SettingsStore from '../../../settings/SettingsStore'; +export const E2E_STATE = { + VERIFIED: "verified", + WARNING: "warning", + UNKNOWN: "unknown", + NORMAL: "normal", +}; + export default function(props) { - const { isUser } = props; - const isNormal = props.status === "normal"; - const isWarning = props.status === "warning"; - const isVerified = props.status === "verified"; + const { isUser, status, className } = props; + const isNormal = status === E2E_STATE.NORMAL; + const isWarning = status === E2E_STATE.WARNING; + const isVerified = status === E2E_STATE.VERIFIED; const e2eIconClasses = classNames({ mx_E2EIcon: true, mx_E2EIcon_warning: isWarning, mx_E2EIcon_normal: isNormal, mx_E2EIcon_verified: isVerified, - }, props.className); + }, className); let e2eTitle; const crossSigning = SettingsStore.isFeatureEnabled("feature_cross_signing"); diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index 634b77c9e1..940515f02e 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -33,6 +33,7 @@ import {MatrixClientPeg} from '../../../MatrixClientPeg'; import {ALL_RULE_TYPES} from "../../../mjolnir/BanList"; import * as ObjectUtils from "../../../ObjectUtils"; import MatrixClientContext from "../../../contexts/MatrixClientContext"; +import {E2E_STATE} from "./E2EIcon"; const eventTileTypes = { 'm.room.message': 'messages.MessageEvent', @@ -66,13 +67,6 @@ const stateEventTileTypes = { 'm.room.related_groups': 'messages.TextualEvent', }; -const E2E_STATE = { - VERIFIED: "verified", - WARNING: "warning", - UNKNOWN: "unknown", - NORMAL: "normal", -}; - // Add all the Mjolnir stuff to the renderer for (const evType of ALL_RULE_TYPES) { stateEventTileTypes[evType] = 'messages.TextualEvent';