fix errors

pull/1757/head
Brice-W 4 years ago
parent 6b8a4ffc6c
commit dcd8da87ca

@ -37,7 +37,11 @@ import { getMentionsInput } from '../../../state/selectors/mentionsInput';
import { updateConfirmModal } from '../../../state/ducks/modalDialog';
import { SessionButtonColor } from '../SessionButton';
import { SessionConfirmDialogProps } from '../SessionConfirm';
import { createOrUpdateItem, getItemById, hasLinkPreviewPopupBeenDisplayed } from '../../../data/data';
import {
createOrUpdateItem,
getItemById,
hasLinkPreviewPopupBeenDisplayed,
} from '../../../data/data';
export interface ReplyingToMessageProps {
convoId: string;
@ -241,10 +245,12 @@ export class SessionCompositionBox extends React.Component<Props, State> {
private async showLinkSharingConfirmationModalDialog(e: any) {
const pastedText = e.clipboardData.getData('text');
if (this.isURL(pastedText)) {
const alreadyDisplayedPopup = (await getItemById(hasLinkPreviewPopupBeenDisplayed))?.value || false;
const alreadyDisplayedPopup =
(await getItemById(hasLinkPreviewPopupBeenDisplayed))?.value || false;
window.inboxStore?.dispatch(
updateConfirmModal({
shouldShowConfirm: () => !window.getSettingValue('link-preview-setting') && !alreadyDisplayedPopup,
shouldShowConfirm: () =>
!window.getSettingValue('link-preview-setting') && !alreadyDisplayedPopup,
title: window.i18n('linkPreviewsTitle'),
message: window.i18n('linkPreviewsConfirmMessage'),
okTheme: SessionButtonColor.Danger,

@ -9,7 +9,11 @@ import { StateType } from '../../../state/reducer';
import { getConversationController } from '../../../session/conversations';
import { getConversationLookup } from '../../../state/selectors/conversations';
import { connect, useSelector } from 'react-redux';
import { getPasswordHash, createOrUpdateItem, hasLinkPreviewPopupBeenDisplayed } from '../../../../ts/data/data';
import {
createOrUpdateItem,
getPasswordHash,
hasLinkPreviewPopupBeenDisplayed,
} from '../../../../ts/data/data';
import { SpacerLG, SpacerXS } from '../../basic/Text';
import { shell } from 'electron';
import { SessionConfirmDialogProps } from '../SessionConfirm';
@ -339,11 +343,11 @@ class SettingsViewInner extends React.Component<SettingsViewProps, State> {
hidden: false,
type: SessionSettingType.Toggle,
category: SessionSettingCategory.Appearance,
setFn: () => {
setFn: async () => {
const newValue = !window.getSettingValue('link-preview-setting');
window.setSettingValue('link-preview-setting', newValue);
if (!newValue) {
createOrUpdateItem({ id: hasLinkPreviewPopupBeenDisplayed, value: false });
await createOrUpdateItem({ id: hasLinkPreviewPopupBeenDisplayed, value: false });
}
},
content: undefined,

Loading…
Cancel
Save