diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-10-24 10:50:27 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-10-24 12:06:10 +0200 |
commit | 42ac987d961441c0413c47d384373476cc8cc833 (patch) | |
tree | 92fec8287cdf1a0d1cdc0f1c719ecd190f2731f8 /src/store | |
parent | 000f3ae886a67639e2a44fe82fd463f89f09ff8f (diff) |
Fix enable ab toggle
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/addressbooks.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/store/addressbooks.js b/src/store/addressbooks.js index 3c745c95..84a0d79b 100644 --- a/src/store/addressbooks.js +++ b/src/store/addressbooks.js @@ -57,7 +57,7 @@ export function mapDavCollectionToAddressbook(addressbook) { displayName: addressbook.displayname, enabled: addressbook.enabled !== false, owner: addressbook.owner, - readOnly: addressbook.readOnly !== false, + readOnly: addressbook.readOnly === true, url: addressbook.url, dav: addressbook } @@ -278,9 +278,15 @@ const actions = { * @returns {Promise} */ async toggleAddressbookEnabled(context, addressbook) { - addressbook.dav.enabled = !addressbook.dav.enabled + addressbook.dav.enabled = !addressbook.enabled return addressbook.dav.update() - .then((response) => context.commit('toggleAddressbookEnabled', addressbook)) + .then((response) => { + context.commit('toggleAddressbookEnabled', addressbook) + if (addressbook.enabled && Object.values(addressbook.contacts).length === 0) { + context.dispatch('getContactsFromAddressBook', { addressbook }) + } + + }) .catch((error) => { throw error }) }, |