mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-30 03:20:45 +08:00
Revert nickname idea (it's not updating as it was not observing)
This commit is contained in:
parent
08ded5bb71
commit
859a18470e
1 changed files with 7 additions and 10 deletions
|
@ -29,7 +29,8 @@ export class ContactModel extends AbstractModel {
|
||||||
surName: '', // LastName
|
surName: '', // LastName
|
||||||
middleName: '', // MiddleName
|
middleName: '', // MiddleName
|
||||||
namePrefix: '', // NamePrefix
|
namePrefix: '', // NamePrefix
|
||||||
nameSuffix: '' // NameSuffix
|
nameSuffix: '', // NameSuffix
|
||||||
|
nickname: null
|
||||||
});
|
});
|
||||||
// this.email = koArrayWithDestroy();
|
// this.email = koArrayWithDestroy();
|
||||||
this.email = ko.observableArray();
|
this.email = ko.observableArray();
|
||||||
|
@ -41,15 +42,6 @@ export class ContactModel extends AbstractModel {
|
||||||
|
|
||||||
fullName: () => (this.givenName() + ' ' + this.surName()).trim(),
|
fullName: () => (this.givenName() + ' ' + this.surName()).trim(),
|
||||||
|
|
||||||
nickname: {
|
|
||||||
read: () => {
|
|
||||||
let prop = this.jCard.getOne('nickname');
|
|
||||||
return prop && prop.value;
|
|
||||||
},
|
|
||||||
write: value =>
|
|
||||||
value ? this.jCard.set('nickname', value/*, params, group*/) : this.jCard.remove('nickname')
|
|
||||||
},
|
|
||||||
|
|
||||||
display: () => {
|
display: () => {
|
||||||
let a = this.jCard.getOne('fn')?.value,
|
let a = this.jCard.getOne('fn')?.value,
|
||||||
b = this.fullName(),
|
b = this.fullName(),
|
||||||
|
@ -98,6 +90,9 @@ export class ContactModel extends AbstractModel {
|
||||||
value && contact[nProps[index]](value)
|
value && contact[nProps[index]](value)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
props = jCard.getOne('nickname');
|
||||||
|
props && contact.nickname(props.value);
|
||||||
|
|
||||||
['email', 'tel', 'url'].forEach(field => {
|
['email', 'tel', 'url'].forEach(field => {
|
||||||
props = jCard.get(field);
|
props = jCard.get(field);
|
||||||
props && props.forEach(prop => {
|
props && props.forEach(prop => {
|
||||||
|
@ -161,6 +156,8 @@ export class ContactModel extends AbstractModel {
|
||||||
]/*, params, group*/);
|
]/*, params, group*/);
|
||||||
// jCard.parseFullName({set:true});
|
// jCard.parseFullName({set:true});
|
||||||
|
|
||||||
|
this.nickname() ? jCard.set('nickname', this.nickname()/*, params, group*/) : jCard.remove('nickname');
|
||||||
|
|
||||||
['email', 'tel', 'url'].forEach(field => {
|
['email', 'tel', 'url'].forEach(field => {
|
||||||
let values = this[field].map(item => item.value());
|
let values = this[field].map(item => item.value());
|
||||||
jCard.get(field).forEach(prop => {
|
jCard.get(field).forEach(prop => {
|
||||||
|
|
Loading…
Reference in a new issue