Contact add Note and improved changes check

This commit is contained in:
the-djmaze 2022-09-08 09:37:27 +02:00
parent f451af2188
commit 9dcdd7e41c
40 changed files with 61 additions and 125 deletions

View file

@ -250,7 +250,7 @@ export class ContactModel extends AbstractModel {
hasChanges()
{
return this.toJSON().jCard != JSON.stringify(this.jCard);
return this.email().filter(v => v.length).length && this.toJSON().jCard != JSON.stringify(this.jCard);
}
toJSON()

View file

@ -199,14 +199,15 @@ export class ContactsPopupView extends AbstractViewPopup {
* @param {?ContactModel} contact
*/
populateViewContact(contact) {
const oldContact = this.contact();
const oldContact = this.contact(),
fn = () => this.contact(contact);
if (oldContact?.hasChanges()) {
AskPopupView.showModal([
i18n('GLOBAL/SAVE_CHANGES'),
() => this.saveContact(oldContact)
() => this.saveContact(oldContact) | fn(),
fn
]);
}
this.contact(contact);
} else fn();
}
/**