Partially revert "Clean up inviteLink handling, harden compose input"

This commit is contained in:
Scott Nonnenberg 2021-05-21 11:32:10 -07:00 committed by GitHub
parent 9f9dd4cd98
commit e859fcd4b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 0 additions and 48 deletions

View file

@ -605,12 +605,6 @@ ipc.on('show-window', () => {
showWindow();
});
ipc.on('set-secure-input', (_sender, enabled) => {
if (app.setSecureKeyboardEntryEnabled) {
app.setSecureKeyboardEntryEnabled(enabled);
}
});
ipc.on('title-bar-double-click', () => {
if (!mainWindow) {
return;

View file

@ -142,9 +142,6 @@ try {
window.log.info('show window');
ipc.send('show-window');
};
window.setSecureInput = enabled => {
ipc.send('set-secure-input', enabled);
};
window.titleBarDoubleClick = () => {
ipc.send('title-bar-double-click');

View file

@ -40,7 +40,6 @@ const createProps = (overrideProps: Partial<Props> = {}): Props => ({
clearQuotedMessage: action('clearQuotedMessage'),
getQuotedMessage: action('getQuotedMessage'),
sortedGroupMembers: [],
setSecureInput: action('setSecureInput'),
// EmojiButton
onPickEmoji: action('onPickEmoji'),
onSetSkinTone: action('onSetSkinTone'),

View file

@ -70,7 +70,6 @@ export type Props = Pick<
| 'draftBodyRanges'
| 'clearQuotedMessage'
| 'getQuotedMessage'
| 'setSecureInput'
> &
Pick<
EmojiButtonProps,
@ -117,7 +116,6 @@ export const CompositionArea = ({
clearQuotedMessage,
getQuotedMessage,
sortedGroupMembers,
setSecureInput,
// EmojiButton
onPickEmoji,
onSetSkinTone,
@ -508,7 +506,6 @@ export const CompositionArea = ({
clearQuotedMessage={clearQuotedMessage}
getQuotedMessage={getQuotedMessage}
sortedGroupMembers={sortedGroupMembers}
setSecureInput={setSecureInput}
/>
</div>
{!large ? (

View file

@ -29,7 +29,6 @@ const createProps = (overrideProps: Partial<Props> = {}): Props => ({
getQuotedMessage: action('getQuotedMessage'),
onPickEmoji: action('onPickEmoji'),
large: boolean('large', overrideProps.large || false),
setSecureInput: action('setSecureInput'),
sortedGroupMembers: overrideProps.sortedGroupMembers || [],
skinTone: select(
'skinTone',

View file

@ -77,7 +77,6 @@ export type Props = {
onSubmit(message: string, mentions: Array<BodyRangeType>): unknown;
getQuotedMessage(): unknown;
clearQuotedMessage(): unknown;
setSecureInput(enabled: boolean): unknown;
};
const MAX_LENGTH = 64 * 1024;
@ -95,7 +94,6 @@ export const CompositionInput: React.ComponentType<Props> = props => {
skinTone,
draftText,
draftBodyRanges,
setSecureInput,
getQuotedMessage,
clearQuotedMessage,
sortedGroupMembers,
@ -252,20 +250,6 @@ export const CompositionInput: React.ComponentType<Props> = props => {
return false;
};
const onFocus = (): void => {
setSecureInput(true);
};
const onBlur = (): void => {
setSecureInput(false);
};
React.useEffect(() => {
return () => {
setSecureInput(false);
};
}, [setSecureInput]);
const onEnter = (): boolean => {
const quill = quillRef.current;
const emojiCompletion = emojiCompletionRef.current;
@ -501,8 +485,6 @@ export const CompositionInput: React.ComponentType<Props> = props => {
onChange,
onEnter,
onEscape,
onFocus,
onBlur,
onPickEmoji,
onShortKeyEnter,
onTab,
@ -517,8 +499,6 @@ export const CompositionInput: React.ComponentType<Props> = props => {
return (
<ReactQuill
className={`${BASE_CLASS_NAME}__quill`}
onFocus={() => callbacksRef.current.onFocus()}
onBlur={() => callbacksRef.current.onBlur()}
onChange={() => callbacksRef.current.onChange()}
defaultValue={delta}
modules={{

View file

@ -53,7 +53,6 @@ const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
onSetSkinTone: action('onSetSkinTone'),
recentEmojis: [],
removeLinkPreview: action('removeLinkPreview'),
setSecureInput: action('setSecureInput'),
skinTone: 0,
});

View file

@ -50,7 +50,6 @@ export type DataPropsType = {
caretLocation?: number
) => unknown;
onTextTooLong: () => void;
setSecureInput: (enabled: boolean) => void;
} & Pick<EmojiButtonProps, 'recentEmojis' | 'skinTone'>;
type ActionPropsType = Pick<
@ -80,7 +79,6 @@ export const ForwardMessageModal: FunctionComponent<PropsType> = ({
recentEmojis,
removeLinkPreview,
skinTone,
setSecureInput,
}) => {
const inputRef = useRef<null | HTMLInputElement>(null);
const inputApiRef = React.useRef<InputApi | undefined>();
@ -309,7 +307,6 @@ export const ForwardMessageModal: FunctionComponent<PropsType> = ({
onPickEmoji={onPickEmoji}
onSubmit={forwardMessage}
onTextTooLong={onTextTooLong}
setSecureInput={setSecureInput}
/>
<div className="module-ForwardMessageModal__emoji">
<EmojiButton

View file

@ -34,7 +34,6 @@ export type SmartForwardMessageModalProps = {
caretLocation?: number
) => unknown;
onTextTooLong: () => void;
setSecureInput: (enabled: boolean) => void;
};
const mapStateToProps = (
@ -49,7 +48,6 @@ const mapStateToProps = (
onClose,
onEditorStateChange,
onTextTooLong,
setSecureInput,
} = props;
const candidateConversations = getAllComposableConversations(state);
@ -70,7 +68,6 @@ const mapStateToProps = (
recentEmojis,
skinTone,
onTextTooLong,
setSecureInput,
};
};

View file

@ -620,9 +620,6 @@ Whisper.ConversationView = Whisper.View.extend({
bodyRanges: Array<typeof window.Whisper.BodyRangeType>,
caretLocation?: number
) => this.onEditorStateChange(msg, bodyRanges, caretLocation),
setSecureInput: (enabled: boolean) => {
window.setSecureInput(enabled);
},
onTextTooLong: () => this.showToast(Whisper.MessageBodyTooLongToast),
onChooseAttachment: this.onChooseAttachment.bind(this),
getQuotedMessage: () => this.model.get('quotedMessageId'),
@ -2252,9 +2249,6 @@ Whisper.ConversationView = Whisper.View.extend({
{},
document.querySelector('.module-ForwardMessageModal')
),
setSecureInput: (enabled: boolean) => {
window.setSecureInput(enabled);
},
}
),
});

1
ts/window.d.ts vendored
View file

@ -239,7 +239,6 @@ declare global {
setAutoHideMenuBar: (value: WhatIsThis) => void;
setBadgeCount: (count: number) => void;
setMenuBarVisibility: (value: WhatIsThis) => void;
setSecureInput: (enabled: boolean) => void;
showConfirmationDialog: (options: ConfirmationDialogViewProps) => void;
showKeyboardShortcuts: () => void;
storage: {