enable back search results on messages content

pull/715/head
Audric Ackermann 6 years ago
parent 89ba00e213
commit 31b98b71be

@ -3,11 +3,11 @@ import { omit, reject } from 'lodash';
import { normalize } from '../../types/PhoneNumber'; import { normalize } from '../../types/PhoneNumber';
import { SearchOptions } from '../../types/Search'; import { SearchOptions } from '../../types/Search';
import { trigger } from '../../shims/events'; import { trigger } from '../../shims/events';
// import { getMessageModel } from '../../shims/Whisper'; import { getMessageModel } from '../../shims/Whisper';
// import { cleanSearchTerm } from '../../util/cleanSearchTerm'; import { cleanSearchTerm } from '../../util/cleanSearchTerm';
import { import {
getPrimaryDeviceFor, getPrimaryDeviceFor,
searchConversations /*, searchMessages */, searchConversations, searchMessages,
} from '../../../js/modules/data'; } from '../../../js/modules/data';
import { makeLookup } from '../../util/makeLookup'; import { makeLookup } from '../../util/makeLookup';
@ -97,9 +97,9 @@ async function doSearch(
): Promise<SearchResultsPayloadType> { ): Promise<SearchResultsPayloadType> {
const { regionCode } = options; const { regionCode } = options;
const [discussions /*, messages */] = await Promise.all([ const [discussions, messages] = await Promise.all([
queryConversationsAndContacts(query, options), queryConversationsAndContacts(query, options),
// queryMessages(query), queryMessages(query),
]); ]);
const { conversations, contacts } = discussions; const { conversations, contacts } = discussions;
@ -108,7 +108,7 @@ async function doSearch(
normalizedPhoneNumber: normalize(query, { regionCode }), normalizedPhoneNumber: normalize(query, { regionCode }),
conversations, conversations,
contacts, contacts,
messages: [], // getMessageProps(messages) || [], messages: getMessageProps(messages) || [],
}; };
} }
function clearSearch(): ClearSearchActionType { function clearSearch(): ClearSearchActionType {
@ -144,27 +144,27 @@ function startNewConversation(
// Helper functions for search // Helper functions for search
// const getMessageProps = (messages: Array<MessageType>) => { const getMessageProps = (messages: Array<MessageType>) => {
// if (!messages || !messages.length) { if (!messages || !messages.length) {
// return []; return [];
// } }
// return messages.map(message => { return messages.map(message => {
// const model = getMessageModel(message); const model = getMessageModel(message);
// return model.propsForSearchResult; return model.propsForSearchResult;
// }); });
// }; };
// async function queryMessages(query: string) { async function queryMessages(query: string) {
// try { try {
// const normalized = cleanSearchTerm(query); const normalized = cleanSearchTerm(query);
// return searchMessages(normalized); return searchMessages(normalized);
// } catch (e) { } catch (e) {
// return []; return [];
// } }
// } }
async function queryConversationsAndContacts( async function queryConversationsAndContacts(
providedQuery: string, providedQuery: string,

Loading…
Cancel
Save