remove lodash calls left from window

pull/1703/head
Audric Ackermann 4 years ago
parent bbbcfd54d6
commit b4fc19fa78
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

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

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

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

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

Loading…
Cancel
Save