This commit is contained in:
Scott Nonnenberg 2024-07-30 16:25:42 -07:00
commit 13ff8fd32e
13 changed files with 158 additions and 17 deletions

View File

@ -62,6 +62,7 @@ const defaultConversations: Array<ConversationType> = [
];
const defaultSearchProps = {
isSearchingGlobally: true,
searchConversation: undefined,
searchDisabled: false,
searchTerm: 'hello',
@ -145,6 +146,8 @@ const useProps = (overrideProps: OverridePropsType = {}): PropsType => {
composeReplaceAvatar: action('composeReplaceAvatar'),
composeSaveAvatarToDisk: action('composeSaveAvatarToDisk'),
createGroup: action('createGroup'),
endConversationSearch: action('endConversationSearch'),
endSearch: action('endSearch'),
getPreferredBadge: () => undefined,
hasFailedStorySends: false,
hasPendingUpdate: false,
@ -609,6 +612,7 @@ export function ArchiveNoArchivedConversations(): JSX.Element {
modeSpecificProps: {
mode: LeftPaneMode.Archive,
archivedConversations: [],
isSearchingGlobally: false,
searchConversation: undefined,
searchTerm: '',
startSearchCounter: 0,
@ -625,6 +629,7 @@ export function ArchiveArchivedConversations(): JSX.Element {
modeSpecificProps: {
mode: LeftPaneMode.Archive,
archivedConversations: defaultConversations,
isSearchingGlobally: false,
searchConversation: undefined,
searchTerm: '',
startSearchCounter: 0,
@ -641,6 +646,7 @@ export function ArchiveSearchingAConversation(): JSX.Element {
modeSpecificProps: {
mode: LeftPaneMode.Archive,
archivedConversations: defaultConversations,
isSearchingGlobally: false,
searchConversation: undefined,
searchTerm: '',
startSearchCounter: 0,

View File

@ -120,6 +120,8 @@ export type PropsType = {
composeReplaceAvatar: ReplaceAvatarActionType;
composeSaveAvatarToDisk: SaveAvatarToDiskActionType;
createGroup: () => void;
endConversationSearch: () => void;
endSearch: () => void;
navTabsCollapsed: boolean;
openUsernameReservationModal: () => void;
onOutgoingAudioCallInConversation: (conversationId: string) => void;
@ -183,6 +185,8 @@ export function LeftPane({
composeSaveAvatarToDisk,
crashReportCount,
createGroup,
endConversationSearch,
endSearch,
getPreferredBadge,
hasExpiredDialog,
hasFailedStorySends,
@ -704,6 +708,8 @@ export function LeftPane({
{helper.getSearchInput({
clearConversationSearch,
clearSearch,
endConversationSearch,
endSearch,
i18n,
onChangeComposeSearchTerm: event => {
setComposeSearchTerm(event.target.value);

View File

@ -15,7 +15,10 @@ type PropsType = {
clearConversationSearch: () => void;
clearSearch: () => void;
disabled?: boolean;
endConversationSearch: () => void;
endSearch: () => void;
i18n: LocalizerType;
isSearchingGlobally: boolean;
onEnterKeyDown?: (
clearSearch: () => void,
showConversation: ShowConversationType
@ -31,7 +34,10 @@ export function LeftPaneSearchInput({
clearConversationSearch,
clearSearch,
disabled,
endConversationSearch,
endSearch,
i18n,
isSearchingGlobally,
onEnterKeyDown,
searchConversation,
searchTerm,
@ -46,6 +52,7 @@ export function LeftPaneSearchInput({
searchConversation?.id
);
const prevSearchCounter = usePrevious(startSearchCounter, startSearchCounter);
const wasSearchingGlobally = usePrevious(false, isSearchingGlobally);
useEffect(() => {
// When user chooses to search in a given conversation we focus the field for them
@ -56,7 +63,10 @@ export function LeftPaneSearchInput({
inputRef.current?.focus();
}
// When user chooses to start a new search, we focus the field
if (startSearchCounter !== prevSearchCounter) {
if (
(isSearchingGlobally && !wasSearchingGlobally) ||
startSearchCounter !== prevSearchCounter
) {
inputRef.current?.select();
}
}, [
@ -64,6 +74,8 @@ export function LeftPaneSearchInput({
prevSearchCounter,
searchConversation,
startSearchCounter,
isSearchingGlobally,
wasSearchingGlobally,
]);
const changeValue = (nextSearchTerm: string) => {
@ -82,11 +94,6 @@ export function LeftPaneSearchInput({
}
};
const clearAndFocus = () => {
clearSearch();
inputRef.current?.focus();
};
const label = searchConversation ? i18n('icu:searchIn') : i18n('icu:search');
return (
@ -98,7 +105,7 @@ export function LeftPaneSearchInput({
moduleClassName="LeftPaneSearchInput"
onBlur={() => {
if (!searchConversation && !searchTerm) {
clearSearch();
endSearch();
}
}}
onKeyDown={event => {
@ -112,10 +119,14 @@ export function LeftPaneSearchInput({
changeValue(event.currentTarget.value);
}}
onClear={() => {
if (searchConversation && searchTerm) {
changeValue('');
if (searchTerm) {
clearSearch();
inputRef.current?.focus();
} else if (searchConversation) {
endConversationSearch();
inputRef.current?.focus();
} else {
clearAndFocus();
inputRef.current?.blur();
}
}}
ref={inputRef}
@ -151,7 +162,7 @@ export function LeftPaneSearchInput({
<button
aria-label={i18n('icu:clearSearch')}
className="LeftPaneSearchInput__in-conversation-pill__x-button"
onClick={clearAndFocus}
onClick={endConversationSearch}
type="button"
/>
</div>

View File

@ -23,6 +23,7 @@ import * as KeyboardLayout from '../../services/keyboardLayout';
type LeftPaneArchiveBasePropsType = {
archivedConversations: ReadonlyArray<ConversationListItemPropsType>;
isSearchingGlobally: boolean;
searchConversation: undefined | ConversationType;
searchTerm: string;
startSearchCounter: number;
@ -35,6 +36,8 @@ export type LeftPaneArchivePropsType =
export class LeftPaneArchiveHelper extends LeftPaneHelper<LeftPaneArchivePropsType> {
private readonly archivedConversations: ReadonlyArray<ConversationListItemPropsType>;
private readonly isSearchingGlobally: boolean;
private readonly searchConversation: undefined | ConversationType;
private readonly searchTerm: string;
@ -47,6 +50,7 @@ export class LeftPaneArchiveHelper extends LeftPaneHelper<LeftPaneArchivePropsTy
super();
this.archivedConversations = props.archivedConversations;
this.isSearchingGlobally = props.isSearchingGlobally;
this.searchConversation = props.searchConversation;
this.searchTerm = props.searchTerm;
this.startSearchCounter = props.startSearchCounter;
@ -82,12 +86,16 @@ export class LeftPaneArchiveHelper extends LeftPaneHelper<LeftPaneArchivePropsTy
override getSearchInput({
clearConversationSearch,
clearSearch,
endConversationSearch,
endSearch,
i18n,
updateSearchTerm,
showConversation,
}: Readonly<{
clearConversationSearch: () => unknown;
clearSearch: () => unknown;
endConversationSearch: () => unknown;
endSearch: () => unknown;
i18n: LocalizerType;
updateSearchTerm: (searchTerm: string) => unknown;
showConversation: ShowConversationType;
@ -100,7 +108,10 @@ export class LeftPaneArchiveHelper extends LeftPaneHelper<LeftPaneArchivePropsTy
<LeftPaneSearchInput
clearConversationSearch={clearConversationSearch}
clearSearch={clearSearch}
endConversationSearch={endConversationSearch}
endSearch={endSearch}
i18n={i18n}
isSearchingGlobally={this.isSearchingGlobally}
searchConversation={this.searchConversation}
searchTerm={this.searchTerm}
showConversation={showConversation}

View File

@ -40,6 +40,8 @@ export abstract class LeftPaneHelper<T> {
_: Readonly<{
clearConversationSearch: () => unknown;
clearSearch: () => unknown;
endConversationSearch: () => unknown;
endSearch: () => unknown;
i18n: LocalizerType;
onChangeComposeSearchTerm: (
event: ChangeEvent<HTMLInputElement>

View File

@ -25,6 +25,7 @@ export type LeftPaneInboxPropsType = {
archivedConversations: ReadonlyArray<ConversationListItemPropsType>;
pinnedConversations: ReadonlyArray<ConversationListItemPropsType>;
isAboutToSearch: boolean;
isSearchingGlobally: boolean;
startSearchCounter: number;
searchDisabled: boolean;
searchTerm: string;
@ -40,6 +41,8 @@ export class LeftPaneInboxHelper extends LeftPaneHelper<LeftPaneInboxPropsType>
private readonly isAboutToSearch: boolean;
private readonly isSearchingGlobally: boolean;
private readonly startSearchCounter: number;
private readonly searchDisabled: boolean;
@ -53,6 +56,7 @@ export class LeftPaneInboxHelper extends LeftPaneHelper<LeftPaneInboxPropsType>
archivedConversations,
pinnedConversations,
isAboutToSearch,
isSearchingGlobally,
startSearchCounter,
searchDisabled,
searchTerm,
@ -64,6 +68,7 @@ export class LeftPaneInboxHelper extends LeftPaneHelper<LeftPaneInboxPropsType>
this.archivedConversations = archivedConversations;
this.pinnedConversations = pinnedConversations;
this.isAboutToSearch = isAboutToSearch;
this.isSearchingGlobally = isSearchingGlobally;
this.startSearchCounter = startSearchCounter;
this.searchDisabled = searchDisabled;
this.searchTerm = searchTerm;
@ -84,12 +89,16 @@ export class LeftPaneInboxHelper extends LeftPaneHelper<LeftPaneInboxPropsType>
override getSearchInput({
clearConversationSearch,
clearSearch,
endConversationSearch,
endSearch,
i18n,
showConversation,
updateSearchTerm,
}: Readonly<{
clearConversationSearch: () => unknown;
clearSearch: () => unknown;
endConversationSearch: () => unknown;
endSearch: () => unknown;
i18n: LocalizerType;
showConversation: ShowConversationType;
updateSearchTerm: (searchTerm: string) => unknown;
@ -98,8 +107,11 @@ export class LeftPaneInboxHelper extends LeftPaneHelper<LeftPaneInboxPropsType>
<LeftPaneSearchInput
clearConversationSearch={clearConversationSearch}
clearSearch={clearSearch}
endConversationSearch={endConversationSearch}
endSearch={endSearch}
disabled={this.searchDisabled}
i18n={i18n}
isSearchingGlobally={this.isSearchingGlobally}
searchConversation={this.searchConversation}
searchTerm={this.searchTerm}
showConversation={showConversation}

View File

@ -44,6 +44,7 @@ export type LeftPaneSearchPropsType = {
primarySendsSms: boolean;
searchTerm: string;
startSearchCounter: number;
isSearchingGlobally: boolean;
searchDisabled: boolean;
searchConversation: undefined | ConversationType;
};
@ -57,6 +58,8 @@ export class LeftPaneSearchHelper extends LeftPaneHelper<LeftPaneSearchPropsType
private readonly contactResults: MaybeLoadedSearchResultsType<ConversationListItemPropsType>;
private readonly isSearchingGlobally: boolean;
private readonly messageResults: MaybeLoadedSearchResultsType<{
id: string;
conversationId: string;
@ -78,6 +81,7 @@ export class LeftPaneSearchHelper extends LeftPaneHelper<LeftPaneSearchPropsType
constructor({
contactResults,
conversationResults,
isSearchingGlobally,
messageResults,
primarySendsSms,
searchConversation,
@ -90,6 +94,7 @@ export class LeftPaneSearchHelper extends LeftPaneHelper<LeftPaneSearchPropsType
this.contactResults = contactResults;
this.conversationResults = conversationResults;
this.isSearchingGlobally = isSearchingGlobally;
this.messageResults = messageResults;
this.primarySendsSms = primarySendsSms;
this.searchConversation = searchConversation;
@ -103,12 +108,16 @@ export class LeftPaneSearchHelper extends LeftPaneHelper<LeftPaneSearchPropsType
override getSearchInput({
clearConversationSearch,
clearSearch,
endConversationSearch,
endSearch,
i18n,
showConversation,
updateSearchTerm,
}: Readonly<{
clearConversationSearch: () => unknown;
clearSearch: () => unknown;
endConversationSearch: () => unknown;
endSearch: () => unknown;
i18n: LocalizerType;
showConversation: ShowConversationType;
updateSearchTerm: (searchTerm: string) => unknown;
@ -117,8 +126,11 @@ export class LeftPaneSearchHelper extends LeftPaneHelper<LeftPaneSearchPropsType
<LeftPaneSearchInput
clearConversationSearch={clearConversationSearch}
clearSearch={clearSearch}
endConversationSearch={endConversationSearch}
endSearch={endSearch}
disabled={this.searchDisabled}
i18n={i18n}
isSearchingGlobally={this.isSearchingGlobally}
onEnterKeyDown={this.onEnterKeyDown}
searchConversation={this.searchConversation}
searchTerm={this.searchTerm}

View File

@ -96,7 +96,7 @@ type UpdateSearchTermActionType = ReadonlyDeep<{
}>;
type StartSearchActionType = ReadonlyDeep<{
type: 'SEARCH_START';
payload: { globalSearch: boolean };
payload: null;
}>;
type ClearSearchActionType = ReadonlyDeep<{
type: 'SEARCH_CLEAR';
@ -106,6 +106,14 @@ type ClearConversationSearchActionType = ReadonlyDeep<{
type: 'CLEAR_CONVERSATION_SEARCH';
payload: null;
}>;
type EndSearchActionType = ReadonlyDeep<{
type: 'SEARCH_END';
payload: null;
}>;
type EndConversationSearchActionType = ReadonlyDeep<{
type: 'END_CONVERSATION_SEARCH';
payload: null;
}>;
type SearchInConversationActionType = ReadonlyDeep<{
type: 'SEARCH_IN_CONVERSATION';
payload: { searchConversationId: string };
@ -118,6 +126,8 @@ export type SearchActionType = ReadonlyDeep<
| StartSearchActionType
| ClearSearchActionType
| ClearConversationSearchActionType
| EndSearchActionType
| EndConversationSearchActionType
| SearchInConversationActionType
| MessageDeletedActionType
| RemoveAllConversationsActionType
@ -132,6 +142,8 @@ export const actions = {
startSearch,
clearSearch,
clearConversationSearch,
endSearch,
endConversationSearch,
searchInConversation,
updateSearchTerm,
};
@ -143,7 +155,7 @@ export const useSearchActions = (): BoundActionCreatorsMapObject<
function startSearch(): StartSearchActionType {
return {
type: 'SEARCH_START',
payload: { globalSearch: true },
payload: null,
};
}
function clearSearch(): ClearSearchActionType {
@ -158,6 +170,18 @@ function clearConversationSearch(): ClearConversationSearchActionType {
payload: null,
};
}
function endSearch(): EndSearchActionType {
return {
type: 'SEARCH_END',
payload: null,
};
}
function endConversationSearch(): EndConversationSearchActionType {
return {
type: 'END_CONVERSATION_SEARCH',
payload: null,
};
}
function searchInConversation(
searchConversationId: string
): SearchInConversationActionType {
@ -405,6 +429,15 @@ export function reducer(
return {
...getEmptyState(),
startSearchCounter: state.startSearchCounter,
searchConversationId: state.searchConversationId,
globalSearch: state.globalSearch,
};
}
if (action.type === 'SEARCH_END') {
return {
...state,
globalSearch: Boolean(state.query) && !state.searchConversationId,
};
}
@ -461,6 +494,14 @@ export function reducer(
};
}
if (action.type === 'END_CONVERSATION_SEARCH') {
return {
...getEmptyState(),
startSearchCounter: state.startSearchCounter + 1,
globalSearch: true,
};
}
if (action.type === 'SEARCH_MESSAGES_RESULTS_FULFILLED') {
const { payload } = action;
const { messages, query } = payload;

View File

@ -91,7 +91,7 @@ export const getStartSearchCounter = createSelector(
(state: SearchStateType): number => state.startSearchCounter
);
export const isSearching = createSelector(
export const getHasSearchQuery = createSelector(
getQuery,
(query: string): boolean => query.trim().length > 0
);

View File

@ -67,12 +67,13 @@ import {
hasNetworkDialog as getHasNetworkDialog,
} from '../selectors/network';
import {
getHasSearchQuery,
getIsSearching,
getIsSearchingGlobally,
getQuery,
getSearchConversation,
getSearchResults,
getStartSearchCounter,
isSearching,
} from '../selectors/search';
import {
isUpdateDownloaded as getIsUpdateDownloaded,
@ -155,19 +156,21 @@ const getModeSpecificProps = (
return {
mode: LeftPaneMode.Archive,
archivedConversations,
isSearchingGlobally: getIsSearchingGlobally(state),
searchConversation,
searchTerm,
startSearchCounter: getStartSearchCounter(state),
...(searchConversation && searchTerm ? getSearchResults(state) : {}),
};
}
if (isSearching(state)) {
if (getHasSearchQuery(state)) {
const primarySendsSms = Boolean(
get(state.items, ['primarySendsSms'], false)
);
return {
mode: LeftPaneMode.Search,
isSearchingGlobally: getIsSearchingGlobally(state),
primarySendsSms,
searchConversation: getSearchConversation(state),
searchDisabled: state.network.challengeStatus !== 'idle',
@ -178,6 +181,7 @@ const getModeSpecificProps = (
return {
mode: LeftPaneMode.Inbox,
isAboutToSearch: getIsSearching(state),
isSearchingGlobally: getIsSearchingGlobally(state),
searchConversation: getSearchConversation(state),
searchDisabled: state.network.challengeStatus !== 'idle',
searchTerm: getQuery(state),
@ -263,7 +267,7 @@ export const SmartLeftPane = memo(function SmartLeftPane({
const getPreferredBadge = useSelector(getPreferredBadgeSelector);
const hasAppExpired = useSelector(hasExpired);
const hasNetworkDialog = useSelector(getHasNetworkDialog);
const hasSearchQuery = useSelector(isSearching);
const hasSearchQuery = useSelector(getHasSearchQuery);
const hasUnsupportedOS = useSelector(isOSUnsupported);
const hasUpdateDialog = useSelector(isUpdateDialogVisible);
const i18n = useSelector(getIntl);
@ -309,6 +313,8 @@ export const SmartLeftPane = memo(function SmartLeftPane({
const {
clearConversationSearch,
clearSearch,
endConversationSearch,
endSearch,
searchInConversation,
startSearch,
updateSearchTerm,
@ -359,6 +365,8 @@ export const SmartLeftPane = memo(function SmartLeftPane({
composeSaveAvatarToDisk={composeSaveAvatarToDisk}
crashReportCount={crashReportCount}
createGroup={createGroup}
endConversationSearch={endConversationSearch}
endSearch={endSearch}
getPreferredBadge={getPreferredBadge}
hasExpiredDialog={hasExpiredDialog}
hasFailedStorySends={hasFailedStorySends}

View File

@ -16,6 +16,7 @@ describe('LeftPaneArchiveHelper', () => {
const defaults = {
archivedConversations: [],
isSearchingGlobally: false,
searchConversation: undefined,
searchTerm: '',
startSearchCounter: 0,

View File

@ -14,6 +14,7 @@ describe('LeftPaneInboxHelper', () => {
const defaultProps: LeftPaneInboxPropsType = {
archivedConversations: [],
conversations: [],
isSearchingGlobally: false,
isAboutToSearch: false,
pinnedConversations: [],
searchConversation: undefined,

View File

@ -22,6 +22,7 @@ describe('LeftPaneSearchHelper', () => {
conversationResults: { isLoading: false, results: [] },
contactResults: { isLoading: false, results: [] },
messageResults: { isLoading: false, results: [] },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -46,6 +47,7 @@ describe('LeftPaneSearchHelper', () => {
conversationResults: { isLoading: true },
contactResults: { isLoading: true },
messageResults: { isLoading: true },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -62,6 +64,7 @@ describe('LeftPaneSearchHelper', () => {
},
contactResults: { isLoading: true },
messageResults: { isLoading: true },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -75,6 +78,7 @@ describe('LeftPaneSearchHelper', () => {
conversationResults: { isLoading: true },
contactResults: { isLoading: true },
messageResults: { isLoading: false, results: [fakeMessage()] },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -90,6 +94,7 @@ describe('LeftPaneSearchHelper', () => {
conversationResults: { isLoading: false, results: [] },
contactResults: { isLoading: false, results: [] },
messageResults: { isLoading: false, results: [] },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -108,6 +113,7 @@ describe('LeftPaneSearchHelper', () => {
},
contactResults: { isLoading: false, results: [] },
messageResults: { isLoading: false, results: [fakeMessage()] },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -126,6 +132,7 @@ describe('LeftPaneSearchHelper', () => {
conversationResults: { isLoading: true },
contactResults: { isLoading: true },
messageResults: { isLoading: true },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -139,6 +146,7 @@ describe('LeftPaneSearchHelper', () => {
},
contactResults: { isLoading: true },
messageResults: { isLoading: true },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -149,6 +157,7 @@ describe('LeftPaneSearchHelper', () => {
conversationResults: { isLoading: true },
contactResults: { isLoading: true },
messageResults: { isLoading: false, results: [fakeMessage()] },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -185,6 +194,7 @@ describe('LeftPaneSearchHelper', () => {
},
contactResults: { isLoading: false, results: contacts },
messageResults: { isLoading: false, results: messages },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -231,6 +241,7 @@ describe('LeftPaneSearchHelper', () => {
},
contactResults: { isLoading: false, results: contacts },
messageResults: { isLoading: false, results: messages },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -268,6 +279,7 @@ describe('LeftPaneSearchHelper', () => {
},
contactResults: { isLoading: false, results: [] },
messageResults: { isLoading: false, results: messages },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -310,6 +322,7 @@ describe('LeftPaneSearchHelper', () => {
},
contactResults: { isLoading: false, results: contacts },
messageResults: { isLoading: false, results: [] },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -344,6 +357,7 @@ describe('LeftPaneSearchHelper', () => {
conversationResults: { isLoading: true },
contactResults: { isLoading: true },
messageResults: { isLoading: true },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -357,6 +371,7 @@ describe('LeftPaneSearchHelper', () => {
},
contactResults: { isLoading: true },
messageResults: { isLoading: true },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -367,6 +382,7 @@ describe('LeftPaneSearchHelper', () => {
conversationResults: { isLoading: true },
contactResults: { isLoading: true },
messageResults: { isLoading: false, results: [fakeMessage()] },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -391,6 +407,7 @@ describe('LeftPaneSearchHelper', () => {
isLoading: false,
results: [fakeMessage(), fakeMessage(), fakeMessage()],
},
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -413,6 +430,7 @@ describe('LeftPaneSearchHelper', () => {
isLoading: false,
results: [fakeMessage(), fakeMessage(), fakeMessage()],
},
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -431,6 +449,7 @@ describe('LeftPaneSearchHelper', () => {
isLoading: false,
results: [fakeMessage(), fakeMessage(), fakeMessage()],
},
isSearchingGlobally: true,
searchTerm: 'bar',
primarySendsSms: false,
searchConversation: undefined,
@ -445,6 +464,7 @@ describe('LeftPaneSearchHelper', () => {
conversationResults: { isLoading: true },
contactResults: { isLoading: true },
messageResults: { isLoading: true },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -460,6 +480,7 @@ describe('LeftPaneSearchHelper', () => {
},
contactResults: { isLoading: true },
messageResults: { isLoading: true },
isSearchingGlobally: true,
searchTerm: 'bar',
primarySendsSms: false,
searchConversation: undefined,
@ -474,6 +495,7 @@ describe('LeftPaneSearchHelper', () => {
conversationResults: { isLoading: true },
contactResults: { isLoading: true },
messageResults: { isLoading: false, results: [fakeMessage()] },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -489,6 +511,7 @@ describe('LeftPaneSearchHelper', () => {
},
contactResults: { isLoading: false, results: [] },
messageResults: { isLoading: false, results: [fakeMessage()] },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -506,6 +529,7 @@ describe('LeftPaneSearchHelper', () => {
},
contactResults: { isLoading: false, results: [] },
messageResults: { isLoading: false, results: [] },
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -521,6 +545,7 @@ describe('LeftPaneSearchHelper', () => {
},
contactResults: { isLoading: true },
messageResults: { isLoading: true },
isSearchingGlobally: true,
searchTerm: 'bar',
primarySendsSms: false,
searchConversation: undefined,
@ -544,6 +569,7 @@ describe('LeftPaneSearchHelper', () => {
isLoading: false,
results: [fakeMessage(), fakeMessage(), fakeMessage()],
},
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -571,6 +597,7 @@ describe('LeftPaneSearchHelper', () => {
isLoading: false,
results: [fakeMessage(), fakeMessage(), fakeMessage()],
},
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -595,6 +622,7 @@ describe('LeftPaneSearchHelper', () => {
isLoading: false,
results: [fakeMessage(), fakeMessage(), expected],
},
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -616,6 +644,7 @@ describe('LeftPaneSearchHelper', () => {
isLoading: false,
results: [fakeMessage(), expected, fakeMessage()],
},
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,
@ -639,6 +668,7 @@ describe('LeftPaneSearchHelper', () => {
isLoading: false,
results: [fakeMessage(), fakeMessage(), fakeMessage()],
},
isSearchingGlobally: true,
searchTerm: 'foo',
primarySendsSms: false,
searchConversation: undefined,