move E2E_STATE to E2EIcon to simplify imports

pull/21833/head
Michael Telatynski 2020-01-22 16:54:31 +00:00
parent 2e0977fb0c
commit 9706114bb5
2 changed files with 14 additions and 12 deletions

View File

@ -14,22 +14,30 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import React from "react";
import classNames from 'classnames'; import classNames from 'classnames';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import AccessibleButton from '../elements/AccessibleButton'; import AccessibleButton from '../elements/AccessibleButton';
import SettingsStore from '../../../settings/SettingsStore'; import SettingsStore from '../../../settings/SettingsStore';
export const E2E_STATE = {
VERIFIED: "verified",
WARNING: "warning",
UNKNOWN: "unknown",
NORMAL: "normal",
};
export default function(props) { export default function(props) {
const { isUser } = props; const { isUser, status, className } = props;
const isNormal = props.status === "normal"; const isNormal = status === E2E_STATE.NORMAL;
const isWarning = props.status === "warning"; const isWarning = status === E2E_STATE.WARNING;
const isVerified = props.status === "verified"; const isVerified = status === E2E_STATE.VERIFIED;
const e2eIconClasses = classNames({ const e2eIconClasses = classNames({
mx_E2EIcon: true, mx_E2EIcon: true,
mx_E2EIcon_warning: isWarning, mx_E2EIcon_warning: isWarning,
mx_E2EIcon_normal: isNormal, mx_E2EIcon_normal: isNormal,
mx_E2EIcon_verified: isVerified, mx_E2EIcon_verified: isVerified,
}, props.className); }, className);
let e2eTitle; let e2eTitle;
const crossSigning = SettingsStore.isFeatureEnabled("feature_cross_signing"); const crossSigning = SettingsStore.isFeatureEnabled("feature_cross_signing");

View File

@ -33,6 +33,7 @@ import {MatrixClientPeg} from '../../../MatrixClientPeg';
import {ALL_RULE_TYPES} from "../../../mjolnir/BanList"; import {ALL_RULE_TYPES} from "../../../mjolnir/BanList";
import * as ObjectUtils from "../../../ObjectUtils"; import * as ObjectUtils from "../../../ObjectUtils";
import MatrixClientContext from "../../../contexts/MatrixClientContext"; import MatrixClientContext from "../../../contexts/MatrixClientContext";
import {E2E_STATE} from "./E2EIcon";
const eventTileTypes = { const eventTileTypes = {
'm.room.message': 'messages.MessageEvent', 'm.room.message': 'messages.MessageEvent',
@ -66,13 +67,6 @@ const stateEventTileTypes = {
'm.room.related_groups': 'messages.TextualEvent', '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 // Add all the Mjolnir stuff to the renderer
for (const evType of ALL_RULE_TYPES) { for (const evType of ALL_RULE_TYPES) {
stateEventTileTypes[evType] = 'messages.TextualEvent'; stateEventTileTypes[evType] = 'messages.TextualEvent';