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(); showWindow();
}); });
ipc.on('set-secure-input', (_sender, enabled) => {
if (app.setSecureKeyboardEntryEnabled) {
app.setSecureKeyboardEntryEnabled(enabled);
}
});
ipc.on('title-bar-double-click', () => { ipc.on('title-bar-double-click', () => {
if (!mainWindow) { if (!mainWindow) {
return; return;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -620,9 +620,6 @@ Whisper.ConversationView = Whisper.View.extend({
bodyRanges: Array<typeof window.Whisper.BodyRangeType>, bodyRanges: Array<typeof window.Whisper.BodyRangeType>,
caretLocation?: number caretLocation?: number
) => this.onEditorStateChange(msg, bodyRanges, caretLocation), ) => this.onEditorStateChange(msg, bodyRanges, caretLocation),
setSecureInput: (enabled: boolean) => {
window.setSecureInput(enabled);
},
onTextTooLong: () => this.showToast(Whisper.MessageBodyTooLongToast), onTextTooLong: () => this.showToast(Whisper.MessageBodyTooLongToast),
onChooseAttachment: this.onChooseAttachment.bind(this), onChooseAttachment: this.onChooseAttachment.bind(this),
getQuotedMessage: () => this.model.get('quotedMessageId'), getQuotedMessage: () => this.model.get('quotedMessageId'),
@ -2252,9 +2249,6 @@ Whisper.ConversationView = Whisper.View.extend({
{}, {},
document.querySelector('.module-ForwardMessageModal') 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; setAutoHideMenuBar: (value: WhatIsThis) => void;
setBadgeCount: (count: number) => void; setBadgeCount: (count: number) => void;
setMenuBarVisibility: (value: WhatIsThis) => void; setMenuBarVisibility: (value: WhatIsThis) => void;
setSecureInput: (enabled: boolean) => void;
showConfirmationDialog: (options: ConfirmationDialogViewProps) => void; showConfirmationDialog: (options: ConfirmationDialogViewProps) => void;
showKeyboardShortcuts: () => void; showKeyboardShortcuts: () => void;
storage: { storage: {