Passive UUID support
Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
parent
f64ca0ed21
commit
a90246cbe5
49 changed files with 2226 additions and 776 deletions
|
@ -148,7 +148,7 @@ function searchMessages(
|
|||
function searchDiscussions(
|
||||
query: string,
|
||||
options: {
|
||||
ourNumber: string;
|
||||
ourConversationId: string;
|
||||
noteToSelf: string;
|
||||
}
|
||||
): SearchDiscussionsResultsKickoffActionType {
|
||||
|
@ -180,15 +180,15 @@ async function doSearchMessages(
|
|||
async function doSearchDiscussions(
|
||||
query: string,
|
||||
options: {
|
||||
ourNumber: string;
|
||||
ourConversationId: string;
|
||||
noteToSelf: string;
|
||||
}
|
||||
): Promise<SearchDiscussionsResultsPayloadType> {
|
||||
const { ourNumber, noteToSelf } = options;
|
||||
const { ourConversationId, noteToSelf } = options;
|
||||
const { conversations, contacts } = await queryConversationsAndContacts(
|
||||
query,
|
||||
{
|
||||
ourNumber,
|
||||
ourConversationId,
|
||||
noteToSelf,
|
||||
}
|
||||
);
|
||||
|
@ -271,9 +271,12 @@ async function queryMessages(query: string, searchConversationId?: string) {
|
|||
|
||||
async function queryConversationsAndContacts(
|
||||
providedQuery: string,
|
||||
options: { ourNumber: string; noteToSelf: string }
|
||||
options: {
|
||||
ourConversationId: string;
|
||||
noteToSelf: string;
|
||||
}
|
||||
) {
|
||||
const { ourNumber, noteToSelf } = options;
|
||||
const { ourConversationId, noteToSelf } = options;
|
||||
const query = providedQuery.replace(/[+-.()]*/g, '');
|
||||
|
||||
const searchResults: Array<DBConversationType> = await dataSearchConversations(
|
||||
|
@ -294,13 +297,20 @@ async function queryConversationsAndContacts(
|
|||
}
|
||||
}
|
||||
|
||||
// // @ts-ignore
|
||||
// console._log(
|
||||
// '%cqueryConversationsAndContacts',
|
||||
// 'background:black;color:red;',
|
||||
// { searchResults, conversations, ourNumber, ourUuid }
|
||||
// );
|
||||
|
||||
// Inject synthetic Note to Self entry if query matches localized 'Note to Self'
|
||||
if (noteToSelf.indexOf(providedQuery.toLowerCase()) !== -1) {
|
||||
// ensure that we don't have duplicates in our results
|
||||
contacts = contacts.filter(id => id !== ourNumber);
|
||||
conversations = conversations.filter(id => id !== ourNumber);
|
||||
contacts = contacts.filter(id => id !== ourConversationId);
|
||||
conversations = conversations.filter(id => id !== ourConversationId);
|
||||
|
||||
contacts.unshift(ourNumber);
|
||||
contacts.unshift(ourConversationId);
|
||||
}
|
||||
|
||||
return { conversations, contacts };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue