From cffaf4a6a252f3f56424dc1c6f9f8d265be3e813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Fri, 21 Sep 2018 11:09:21 +0200 Subject: Really load the server contacts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- src/models/contact.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/models') diff --git a/src/models/contact.js b/src/models/contact.js index 438b1f22..63b3b777 100644 --- a/src/models/contact.js +++ b/src/models/contact.js @@ -28,11 +28,12 @@ export default class Contact { /** * Creates an instance of Contact * - * @param {string} [vcard] the vcard data as string with proper new lines - * @param {object} [addressbook] the addressbook which the contat belongs to + * @param {string} vcard the vcard data as string with proper new lines + * @param {object} addressbook the addressbook which the contat belongs to + * @param {string} [url] the url of the contact * @memberof Contact */ - constructor(vcard = '', addressbook) { + constructor(vcard = '', addressbook, url) { let jCal = ICAL.parse(vcard) if (jCal[0] !== 'vcard') { throw new Error('Only one contact is allowed in the vcard data') @@ -41,6 +42,7 @@ export default class Contact { this.jCal = jCal this.addressbook = addressbook this.vCard = new ICAL.Component(this.jCal) + this.url = url // if no uid set, create one if (!this.vCard.hasProperty('uid')) { -- cgit v1.2.3 From ba72cdbadf5b44fe99aef97c060ce88cbad6445e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Fri, 21 Sep 2018 19:36:46 +0200 Subject: Fixed deletion on details, improved loading performances and comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- src/models/contact.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/models') diff --git a/src/models/contact.js b/src/models/contact.js index 63b3b777..e23fffff 100644 --- a/src/models/contact.js +++ b/src/models/contact.js @@ -31,9 +31,10 @@ export default class Contact { * @param {string} vcard the vcard data as string with proper new lines * @param {object} addressbook the addressbook which the contat belongs to * @param {string} [url] the url of the contact + * @param {string} [etag] the current etag of the contact * @memberof Contact */ - constructor(vcard = '', addressbook, url) { + constructor(vcard = '', addressbook, url = '', etag = '') { let jCal = ICAL.parse(vcard) if (jCal[0] !== 'vcard') { throw new Error('Only one contact is allowed in the vcard data') -- cgit v1.2.3 From 145babb087c1d827e2049a05dfcaa6535fb8c3ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Mon, 24 Sep 2018 15:27:29 +0200 Subject: Add addressbook dav MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- src/models/contact.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/models') diff --git a/src/models/contact.js b/src/models/contact.js index e23fffff..9dc6ced5 100644 --- a/src/models/contact.js +++ b/src/models/contact.js @@ -232,9 +232,11 @@ export default class Contact { } if (this.vCard.hasProperty('n')) { // reverse and join - return this.vCard.getFirstPropertyValue('n').filter(function(part) { - return part - }).join(' ') + return this.vCard.getFirstPropertyValue('n') + .filter(function(part) { + return part + }) + .join(' ') } return null } -- cgit v1.2.3 From f3c1f13792d78e3617e3d3f726d1324f3ea576ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Mon, 24 Sep 2018 23:46:01 +0200 Subject: Fixed select property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- src/models/rfcProps.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/models') diff --git a/src/models/rfcProps.js b/src/models/rfcProps.js index cae39970..e2cdb40b 100644 --- a/src/models/rfcProps.js +++ b/src/models/rfcProps.js @@ -140,7 +140,7 @@ const properties = { default: true, defaultValue: { value: '', - type: ['HOME,VOICE'] + type: ['HOME', 'VOICE'] }, options: [ { id: 'HOME,VOICE', name: t('contacts', 'Home') }, @@ -183,6 +183,7 @@ const properties = { }, relationship: { readableName: t('contacts', 'Relationship'), + force: 'select', info: t( 'contacts', 'Specify a relationship between you and the entity represented by this vCard.' @@ -234,6 +235,10 @@ const properties = { }, gender: { readableName: t('contacts', 'Gender'), + defaultValue: { + // default to Female 🙋 + value: ['F'] + }, options: [ { id: 'F', name: t('contacts', 'Female') }, { id: 'M', name: t('contacts', 'Male') }, -- cgit v1.2.3 From 040992884b416d5c86e3a06731f26a5b1c68d7a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Tue, 25 Sep 2018 12:07:19 +0200 Subject: JSDoc fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- src/models/contact.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/models') diff --git a/src/models/contact.js b/src/models/contact.js index 9dc6ced5..de1ba9a7 100644 --- a/src/models/contact.js +++ b/src/models/contact.js @@ -55,7 +55,7 @@ export default class Contact { /** * Update internal data of this contact * - * @param {jCal} jCal + * @param {jCal} jCal jCal object from ICAL.js * @memberof Contact */ updateContact(jCal) { @@ -66,7 +66,7 @@ export default class Contact { /** * Update linked addressbook of this contact * - * @param {Object} addressbook + * @param {Object} addressbook the addressbook * @memberof Contact */ updateAddressbook(addressbook) { @@ -78,8 +78,8 @@ export default class Contact { * into a string by taking the first element * e.g. ORG:ABC\, Inc.; will output an array because of the semi-colon * - * @param {Array|string} data - * @returns string + * @param {Array|string} data the data to normalize + * @returns {string} * @memberof Contact */ firstIfArray(data) { @@ -99,6 +99,7 @@ export default class Contact { /** * Set the uid * + * @param {string} uid the uid to set * @memberof Contact */ set uid(uid) { @@ -133,7 +134,7 @@ export default class Contact { /** * Set the groups * - * @readonly + * @param {Array} groups the groups to set * @memberof Contact */ set groups(groups) { @@ -175,6 +176,7 @@ export default class Contact { /** * Set the org * + * @param {string} org the org data * @memberof Contact */ set org(org) { @@ -194,6 +196,7 @@ export default class Contact { /** * Set the title * + * @param {string} title the title * @memberof Contact */ set title(title) { @@ -213,6 +216,7 @@ export default class Contact { /** * Set the full name * + * @param {string} name the fn data * @memberof Contact */ set fullName(name) { @@ -287,6 +291,7 @@ export default class Contact { /** * Add the contact to the group * + * @param {string} group the group to add the contact to * @memberof Contact */ addToGroup(group) { -- cgit v1.2.3 From 7349a6fc5bf22d50ac1550f73c12ebdb7536c16f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Tue, 25 Sep 2018 12:40:22 +0200 Subject: Contact deletion fix and warning if fetchFull fails and/of contact gone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- src/models/contact.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/models') diff --git a/src/models/contact.js b/src/models/contact.js index de1ba9a7..3836d91d 100644 --- a/src/models/contact.js +++ b/src/models/contact.js @@ -30,11 +30,15 @@ export default class Contact { * * @param {string} vcard the vcard data as string with proper new lines * @param {object} addressbook the addressbook which the contat belongs to - * @param {string} [url] the url of the contact - * @param {string} [etag] the current etag of the contact + * @param {string} [url=''] the url of the contact + * @param {string} [etag=''] the current etag of the contact * @memberof Contact */ - constructor(vcard = '', addressbook, url = '', etag = '') { + constructor(vcard, addressbook, url = '', etag = '') { + if (typeof vcard !== 'string' || vcard.length === 0) { + throw new Error('Invalid vCard') + } + let jCal = ICAL.parse(vcard) if (jCal[0] !== 'vcard') { throw new Error('Only one contact is allowed in the vcard data') -- cgit v1.2.3 From 5cfd621af1504c8804ae4941be2af1b84eeb6767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Tue, 25 Sep 2018 12:42:09 +0200 Subject: Home mobile compatibility addition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- src/models/rfcProps.js | 1 + 1 file changed, 1 insertion(+) (limited to 'src/models') diff --git a/src/models/rfcProps.js b/src/models/rfcProps.js index e2cdb40b..f1a5e083 100644 --- a/src/models/rfcProps.js +++ b/src/models/rfcProps.js @@ -150,6 +150,7 @@ const properties = { { id: 'CELL', name: t('contacts', 'Mobile') }, { id: 'CELL,VOICE', name: t('contacts', 'Mobile') }, { id: 'WORK,CELL', name: t('contacts', 'Work mobile') }, + { id: 'HOME,CELL', name: t('contacts', 'Home mobile') }, { id: 'FAX', name: t('contacts', 'Fax') }, { id: 'HOME,FAX', name: t('contacts', 'Fax home') }, { id: 'WORK,FAX', name: t('contacts', 'Fax work') }, -- cgit v1.2.3 From 8b0fadc2ea2aa6b6d2327f71ad1adb6484783537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Tue, 25 Sep 2018 17:22:05 +0200 Subject: Added icon and proper info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- src/models/rfcProps.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/models') diff --git a/src/models/rfcProps.js b/src/models/rfcProps.js index cae39970..1c1b0ac8 100644 --- a/src/models/rfcProps.js +++ b/src/models/rfcProps.js @@ -183,6 +183,7 @@ const properties = { }, relationship: { readableName: t('contacts', 'Relationship'), + icon: 'icon-group', info: t( 'contacts', 'Specify a relationship between you and the entity represented by this vCard.' @@ -205,6 +206,7 @@ const properties = { related: { multiple: true, readableName: t('contacts', 'Related'), + icon: 'icon-group', info: t( 'contacts', 'Specify a relationship between another entity and the entity represented by this vCard.' -- cgit v1.2.3