summaryrefslogtreecommitdiffstats
path: root/src/store
diff options
context:
space:
mode:
authorJohannes Zlattinger <johannes@zlattinger.net>2020-12-30 13:57:15 +0100
committerJohannes Zlattinger <johannes@zlattinger.net>2021-05-07 20:48:30 +0200
commit564f6dc7565daea48bd269bfb47a6cac9e7c97d1 (patch)
treed7ceee2e9ffe19fa6ae099f6487f01b817c81972 /src/store
parent639e2a186eb955e8d114ca965ae0522d969b6420 (diff)
improve compatibily with macOS contacts
Signed-off-by: Johannes Zlattinger <johannes@zlattinger.net>
Diffstat (limited to 'src/store')
-rw-r--r--src/store/addressbooks.js5
-rw-r--r--src/store/contacts.js17
2 files changed, 19 insertions, 3 deletions
diff --git a/src/store/addressbooks.js b/src/store/addressbooks.js
index fbef374a..5b20cf0a 100644
--- a/src/store/addressbooks.js
+++ b/src/store/addressbooks.js
@@ -25,7 +25,7 @@ import { showError } from '@nextcloud/dialogs'
import pLimit from 'p-limit'
import Vue from 'vue'
-import Contact from '../models/contact'
+import Contact, { MinimalContactProperties } from '../models/contact'
import client from '../services/cdav'
import parseVcf from '../services/parseVcf'
@@ -346,8 +346,7 @@ const actions = {
*/
async getContactsFromAddressBook(context, { addressbook }) {
return addressbook.dav
- .findAllAndFilterBySimpleProperties(['EMAIL', 'UID', 'CATEGORIES', 'FN', 'ORG', 'N',
- 'X-PHONETIC-FIRST-NAME', 'X-PHONETIC-LAST-NAME'])
+ .findAllAndFilterBySimpleProperties(MinimalContactProperties)
.then((response) => {
// We don't want to lose the url information
// so we need to parse one by one
diff --git a/src/store/contacts.js b/src/store/contacts.js
index 9698bdba..0e8eb690 100644
--- a/src/store/contacts.js
+++ b/src/store/contacts.js
@@ -27,6 +27,23 @@ import Vue from 'vue'
import Contact from '../models/contact'
import validate from '../services/validate'
+/*
+ * Currently ical.js does not serialize parameters with multiple values correctly. This is
+ * especially problematic for the type parmeter which frequently is used with multiple values
+ * (e.g. "HOME" and "VOICE"). A phone number for example shoud be serialized as
+ * 'TEL;TYPE=HOME,VOICE:0815 123456' OR 'TEL;TYPE="HOME","VOICE":0815 123456' according to
+ * https://tools.ietf.org/html/rfc2426#section-4. Unfortunately currently it is serialized as
+ * 'TEL;TYPE="HOME,VOICE":0815 123456', which makes the value appear as a single value
+ * containing a comma instead of two separate values. By forcing all values being escaped by
+ * double quotes the string serialization can be fixed.
+ *
+ * However there is a pull request (https://github.com/mozilla-comm/ical.js/pull/460) waiting
+ * to be merged for ical.js. Until this fix is merged and released the following configuration
+ * changes apply the workaround described above.
+ */
+ICAL.design.vcard3.param.type.multiValueSeparateDQuote = true
+ICAL.design.vcard.param.type.multiValueSeparateDQuote = true
+
const sortData = (a, b) => {
const nameA = typeof a.value === 'string'
? a.value.toUpperCase() // ignore upper and lowercase