diff --git a/stylesheets/_session_theme.scss b/stylesheets/_session_theme.scss index 9fc7ae020..7093a3296 100644 --- a/stylesheets/_session_theme.scss +++ b/stylesheets/_session_theme.scss @@ -79,7 +79,6 @@ } } } - } .message { diff --git a/ts/components/LeftPane.tsx b/ts/components/LeftPane.tsx index c7e175f04..55ce80a02 100644 --- a/ts/components/LeftPane.tsx +++ b/ts/components/LeftPane.tsx @@ -137,33 +137,22 @@ export class LeftPane extends React.Component { } private renderContactSection() { - const { - openConversationInternal, - conversations, - searchResults, - searchTerm, - isSecondaryDevice, - updateSearchTerm, - search, - clearSearch, - contacts, - } = this.props; + const { openConversationInternal } = this.props; + + const directContacts = this.getDirectContactsOnly(); return ( ); } + private getDirectContactsOnly() { + return this.props.contacts.filter(f => f.type === 'direct'); + } + private renderSettingSection() { const { isSecondaryDevice } = this.props; diff --git a/ts/components/session/LeftPaneContactSection.tsx b/ts/components/session/LeftPaneContactSection.tsx index eec649874..af1442c5a 100644 --- a/ts/components/session/LeftPaneContactSection.tsx +++ b/ts/components/session/LeftPaneContactSection.tsx @@ -1,13 +1,6 @@ import React from 'react'; -import { - ConversationListItemWithDetails, - PropsData as ConversationListItemPropsType, -} from '../ConversationListItem'; -import { PropsData as SearchResultsProps } from '../SearchResults'; -import { debounce } from 'lodash'; -import { cleanSearchTerm } from '../../util/cleanSearchTerm'; -import { SearchOptions } from '../../types/Search'; +import { ConversationListItemWithDetails } from '../ConversationListItem'; import { LeftPane, RowRendererParamsType } from '../LeftPane'; import { SessionButton, @@ -25,17 +18,9 @@ import { MainViewController } from '../MainViewController'; import { ToastUtils } from '../../session/utils'; export interface Props { - searchTerm: string; - isSecondaryDevice: boolean; - - conversations: Array; - contacts: Array; - searchResults?: SearchResultsProps; + directContacts: Array; - updateSearchTerm: (searchTerm: string) => void; - search: (query: string, options: SearchOptions) => void; openConversationInternal: (id: string, messageId?: string) => void; - clearSearch: () => void; } interface State { @@ -45,8 +30,6 @@ interface State { } export class LeftPaneContactSection extends React.Component { - private readonly debouncedSearch: (searchTerm: string) => void; - public constructor(props: Props) { super(props); this.state = { @@ -55,7 +38,6 @@ export class LeftPaneContactSection extends React.Component { pubKeyPasted: '', }; - this.debouncedSearch = debounce(this.search.bind(this), 20); this.handleToggleOverlay = this.handleToggleOverlay.bind(this); this.handleOnAddContact = this.handleOnAddContact.bind(this); this.handleRecipientSessionIDChanged = this.handleRecipientSessionIDChanged.bind( @@ -75,7 +57,6 @@ export class LeftPaneContactSection extends React.Component { } public componentWillUnmount() { - this.updateSearch(''); this.setState({ addContactRecipientID: '' }); window.Whisper.events.off('calculatingPoW', this.closeOverlay); } @@ -109,12 +90,12 @@ export class LeftPaneContactSection extends React.Component { key, style, }: RowRendererParamsType): JSX.Element | undefined => { - const contacts = this.getDirectContactsOnly(); - const item = contacts[index]; + const { directContacts } = this.props; + const item = directContacts[index]; return ( { ); }; - public updateSearch(searchTerm: string) { - const { updateSearchTerm, clearSearch } = this.props; - - if (!searchTerm) { - clearSearch(); - - return; - } - - this.setState({ pubKeyPasted: '' }); - - if (updateSearchTerm) { - updateSearchTerm(searchTerm); - } - - if (searchTerm.length < 2) { - return; - } - - const cleanedTerm = cleanSearchTerm(searchTerm); - if (!cleanedTerm) { - return; - } - - this.debouncedSearch(cleanedTerm); - } - - public clearSearch() { - this.props.clearSearch(); - } - - public search() { - const { search } = this.props; - const { searchTerm, isSecondaryDevice } = this.props; - - if (search) { - search(searchTerm, { - noteToSelf: window.i18n('noteToSelf').toLowerCase(), - ourNumber: window.textsecure.storage.user.getNumber(), - regionCode: '', - isSecondaryDevice, - }); - } - } - private renderClosableOverlay() { return ( { ); } - private getDirectContactsOnly() { - return this.props.contacts.filter(f => f.type === 'direct'); - } - private renderList() { - const contacts = this.getDirectContactsOnly(); - const length = Number(contacts.length); + const { directContacts } = this.props; + const length = Number(directContacts.length); const list = (
@@ -249,6 +181,7 @@ export class LeftPaneContactSection extends React.Component {