remove lodash calls left from window

This commit is contained in:
Audric Ackermann 2021-06-17 16:54:14 +10:00
parent bbbcfd54d6
commit b4fc19fa78
No known key found for this signature in database
GPG key ID: 999F434D76324AD4
4 changed files with 8 additions and 15 deletions

View file

@ -25,8 +25,6 @@ if (config.appInstance) {
title += ` - ${config.appInstance}`;
}
window.Lodash = require('lodash');
global.dcodeIO = global.dcodeIO || {};
global.dcodeIO.ByteBuffer = require('bytebuffer');

View file

@ -46,7 +46,6 @@ const OnionPathModalInner = (props: any) => {
label: window.i18n('device'),
},
...onionNodes,
,
{
label: window.i18n('destination'),
},
@ -63,6 +62,7 @@ const OnionPathModalInner = (props: any) => {
glowStartDelay={index}
label={snode.label}
snode={snode}
key={index}
/>
);
})}
@ -80,8 +80,6 @@ export type OnionNodeStatusLightType = {
/**
* Component containing a coloured status light and an adjacent country label.
* @param props
* @returns
*/
export const OnionNodeStatusLight = (props: OnionNodeStatusLightType): JSX.Element => {
const { snode, label, glowStartDelay, glowDuration } = props;
@ -97,7 +95,7 @@ export const OnionNodeStatusLight = (props: OnionNodeStatusLightType): JSX.Eleme
glowDuration={glowDuration}
glowStartDelay={glowStartDelay}
color={theme.colors.accent}
></ModalStatusLight>
/>
{labelText ? (
<>
<div className="onion-node__country">{labelText}</div>
@ -156,7 +154,7 @@ export const ActionPanelOnionStatusLight = (props: {
} else {
const onionSnodePath = onionState.snodePath;
if (onionState && onionSnodePath && onionSnodePath.length > 0) {
let onionNodeCount = onionSnodePath.length;
const onionNodeCount = onionSnodePath.length;
iconColor = onionNodeCount > 2 ? green : onionNodeCount > 1 ? orange : red;
}
}
@ -175,9 +173,10 @@ export const ActionPanelOnionStatusLight = (props: {
export const OnionPathModal = (props: OnionPathModalType) => {
const onConfirm = () => {
shell.openExternal('https://getsession.org/faq/#onion-routing');
void shell.openExternal('https://getsession.org/faq/#onion-routing');
};
return (
// tslint:disable-next-line: use-simple-attributes
<SessionWrapperModal
title={props.title || window.i18n('onionPathIndicatorTitle')}
confirmText={props.confirmText || window.i18n('learnMore')}
@ -186,7 +185,7 @@ export const OnionPathModal = (props: OnionPathModalType) => {
onClose={props.onClose}
showExitIcon={true}
>
<OnionPathModalInner {...props}></OnionPathModalInner>
<OnionPathModalInner {...props} />
</SessionWrapperModal>
);
};

View file

@ -1,8 +1,7 @@
import React, { useState } from 'react';
import { ConversationController } from '../../session/conversations/ConversationController';
import { SessionModal } from './SessionModal';
import { SessionButton } from './SessionButton';
import { DefaultTheme, withTheme, useTheme } from 'styled-components';
import { DefaultTheme, useTheme, withTheme } from 'styled-components';
import _ from 'lodash';
import { SessionWrapperModal } from './SessionWrapperModal';

View file

@ -651,10 +651,7 @@ export class SessionConversation extends React.Component<Props, State> {
};
const onSubmit = async (newMembers: Array<string>) => {
const _ = window.Lodash;
const ourPK = Utils.UserUtils.getOurPubKeyStrFromCache();
const allMembersAfterUpdate = window.Lodash.concat(newMembers, [ourPK]);
const allMembersAfterUpdate = _.concat(newMembers, [ourPK]);
if (!isAdmin) {
window.log.warn('Skipping update of members, we are not the admin');