Skip to content

Commit 2726d86

Browse files
danieltigsePedro Aim
authored andcommitted
bug fixes in composer
1 parent a35d1d8 commit 2726d86

File tree

21 files changed

+37
-41
lines changed

21 files changed

+37
-41
lines changed

electron_app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "criptext",
3-
"version": "0.27.5",
3+
"version": "0.28.0",
44
"author": {
55
"name": "Criptext Inc",
66
"email": "[email protected]",

electron_app/src/__integrations__/Contact.integration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe('Update data contact from Contact Table:', () => {
105105

106106
describe('Load data contact from Contact Table:', () => {
107107
it('should load all contacts', async () => {
108-
const contacts = await DBManager.getAllContacts({ accountId });
108+
const contacts = await DBManager.getAllContacts();
109109
expect(contacts).toMatchSnapshot();
110110
});
111111

electron_app/src/database/DBEmanager.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,17 +242,10 @@ const createContactsIfOrNotStore = async ({ accountId, contacts }, trx) => {
242242
return emailAddresses;
243243
};
244244

245-
const getAllContacts = ({ accountId }) => {
245+
const getAllContacts = () => {
246246
return Contact()
247247
.findAll({
248248
attributes: ['name', 'email'],
249-
include: [
250-
{
251-
model: AccountContact(),
252-
attributes: [],
253-
where: { accountId }
254-
}
255-
],
256249
order: [['score', 'DESC'], ['name']]
257250
})
258251
.map(account => account.toJSON());

electron_app/src/ipc/database.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,7 @@ ipc.answerRenderer('db-get-account-by-params', params =>
9898
dbManager.getAccountByParams(params)
9999
);
100100

101-
ipc.answerRenderer('db-get-all-contacts', params => {
102-
const data = params.accountId
103-
? params
104-
: { ...params, accountId: myAccount.id };
105-
return dbManager.getAllContacts(data);
106-
});
101+
ipc.answerRenderer('db-get-all-contacts', () => dbManager.getAllContacts());
107102

108103
ipc.answerRenderer('db-get-all-feed-items', params => {
109104
const data = params.accountId

email_composer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "email_composer",
3-
"version": "0.27.5",
3+
"version": "0.28.0",
44
"private": true,
55
"dependencies": {
66
"@criptext/electron-better-ipc": "^0.7.0-rc1-0.2",

email_composer/src/components/AutocompleteWrapper.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const AutocompleteWrapper = ({ addTag, ...props }) => {
2121
const loadSuggestions = async () => {
2222
if (!people && !isConsulting) {
2323
isConsulting = true;
24-
people = await getAllContacts({});
24+
people = await getAllContacts();
2525
isConsulting = !people;
2626
}
2727
};
@@ -58,7 +58,7 @@ const AutocompleteWrapper = ({ addTag, ...props }) => {
5858
const inputValue = (props.value && props.value.trim().toLowerCase()) || '';
5959
const inputLength = inputValue.length;
6060
const getSuggestions = () => {
61-
if (inputLength === 0) return [];
61+
if (inputLength < 2) return [];
6262
if (
6363
lastTextValue.length > inputLength ||
6464
inputLength === 0 ||
@@ -76,7 +76,7 @@ const AutocompleteWrapper = ({ addTag, ...props }) => {
7676
: false;
7777
return emailHasMatches || nameHasMatches;
7878
});
79-
return filtered;
79+
return filtered.slice(0, 50);
8080
};
8181
state.filteredSuggestions = getSuggestions();
8282
const getSuggestionValue = suggestion => suggestion.email;
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
/* eslint no-useless-escape: 0 */
22
export const emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
33
export const HTMLTagsRegex = /<[^>]*>?/g;
4-
export const contactsRegex = string =>
5-
new RegExp(`(^${string}| ${string})`, 'i');
4+
export const contactsRegex = string => {
5+
const escaped = escapeRegEx(string);
6+
return new RegExp(`(^${escaped}| ${escaped})`, 'i');
7+
};
8+
const escapeRegEx = s => {
9+
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
10+
};

email_composer/src/utils/ipc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ export const deleteSessionRecord = async params => {
9494
return await ipc.callMain('db-delete-session-record', params);
9595
};
9696

97-
export const getAllContacts = async params => {
98-
return await ipc.callMain('db-get-all-contacts', params);
97+
export const getAllContacts = async () => {
98+
return await ipc.callMain('db-get-all-contacts');
9999
};
100100

101101
export const getContactsByEmailId = async emailId => {

email_loading/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "email_loading",
3-
"version": "0.27.5",
3+
"version": "0.28.0",
44
"private": true,
55
"dependencies": {
66
"@criptext/electron-better-ipc": "^0.7.0-rc1-0.2",

email_login/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "email_login",
3-
"version": "0.27.5",
3+
"version": "0.28.0",
44
"private": true,
55
"dependencies": {
66
"@criptext/electron-better-ipc": "^0.7.0-rc1-0.2",

0 commit comments

Comments
 (0)