summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJessica <jessica@Absolventas-MacBook-Pro.local>2018-08-13 19:24:27 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-08-28 15:33:46 +0200
commit8505db5262f11033534ad8e7c4feecf5fe36271d (patch)
tree8f9cd9ded8e76984644a3d1ea78a0a9758fcf967 /src
parent5e1a74a21cc71b53d51eb6836f12cb078fd53307 (diff)
added group to sharee so to distinguish groups and users and decide which icon to display
Diffstat (limited to 'src')
-rw-r--r--src/components/Settings/SettingsAddressbook.vue8
-rw-r--r--src/components/Settings/SettingsAddressbookShare.vue22
-rw-r--r--src/components/Settings/SettingsAddressbookShare.vue.orig197
-rw-r--r--src/components/Settings/SettingsAddressbookSharee.vue3
-rw-r--r--src/components/Settings/SettingsNewAddressbook.vue2
-rw-r--r--src/components/SettingsSection.vue12
-rw-r--r--src/services/api.js.orig130
-rw-r--r--src/store/addressbooks.js3
-rw-r--r--src/store/addressbooks.js.orig248
9 files changed, 27 insertions, 598 deletions
diff --git a/src/components/Settings/SettingsAddressbook.vue b/src/components/Settings/SettingsAddressbook.vue
index a143c8ba..8544794b 100644
--- a/src/components/Settings/SettingsAddressbook.vue
+++ b/src/components/Settings/SettingsAddressbook.vue
@@ -39,21 +39,21 @@
</a>
</li>
<!-- sharing input -->
- <share-address-book v-if="shareOpen" :addressbook="addressbook" />
+ <share-addressbook v-if="shareOpen" :addressbook="addressbook" />
</div>
</template>
<script>
import popoverMenu from '../core/popoverMenu'
-import shareAddressBook from './SettingsAddressbookShare'
+import shareAddressbook from './SettingsAddressbookShare'
import clickOutside from 'vue-click-outside'
export default {
- name: 'SettingsAddressBook',
+ name: 'SettingsAddressbook',
components: {
popoverMenu,
- shareAddressBook,
+ shareAddressbook,
clickOutside
},
directives: {
diff --git a/src/components/Settings/SettingsAddressbookShare.vue b/src/components/Settings/SettingsAddressbookShare.vue
index 76629f73..f1ebb54e 100644
--- a/src/components/Settings/SettingsAddressbookShare.vue
+++ b/src/components/Settings/SettingsAddressbookShare.vue
@@ -49,25 +49,25 @@
</multiselect>
<!-- list of user or groups addressbook is shared with -->
<ul v-if="addressbook.shares.length > 0" class="addressbook__shares__list">
- <address-book-sharee v-for="sharee in addressbook.shares" :key="sharee.displayname" :sharee="sharee" />
+ <addressbook-sharee v-for="sharee in addressbook.shares" :key="sharee.displayname + sharee.group" :sharee="sharee" />
</ul>
</div>
</template>
<script>
import Multiselect from 'vue-multiselect'
-import addressBookSharee from './SettingsAddressbookSharee'
+import addressbookSharee from './SettingsAddressbookSharee'
import clickOutside from 'vue-click-outside'
import api from '../../services/api'
export default {
- name: 'SettingsShareAddressBook',
+ name: 'SettingsShareAddressbook',
components: {
clickOutside,
Multiselect,
- addressBookSharee
+ addressbookSharee
},
directives: {
clickOutside
@@ -99,10 +99,11 @@ export default {
let payload = []
payload.push(this.addressbook)
payload.push(chosenUserOrGroup.match)
+ payload.push(chosenUserOrGroup.matchgroup)
this.$store.dispatch('shareAddressbook', payload)
},
- formatMatchResults(matches, query, matchTag) {
+ formatMatchResults(matches, query, group) {
// format response from axios.all and add them to the option array
if (matches.length < 1) {
return
@@ -110,17 +111,18 @@ export default {
let regex = new RegExp(query, 'i')
for (let i = 0; i < matches.length; i++) {
for (let j = 0; j < this.addressbook.shares.length; j++) {
- if (this.addressbook.shares[j].displayname === matches[i] + ' ' + matchTag) {
+ if (this.addressbook.shares[j].displayname === matches[i] && this.addressbook.shares[j].group === group) {
return
}
}
let matchResult = matches[i].split(regex)
let newMatch = {
- match: matches[i] + ' ' + matchTag,
+ match: matches[i],
matchstart: matchResult[0],
matchpattern: matches[i].match(regex)[0],
matchend: matchResult[1],
- matchtag: matchTag
+ matchtag: group ? '(group)' : '(user)',
+ matchgroup: group
}
this.usersOrGroups.push(newMatch)
}
@@ -137,12 +139,12 @@ export default {
let matchingUsers = response[0].data.ocs.data.users
let matchingGroups = response[1].data.ocs.data.groups
try {
- this.formatMatchResults(matchingUsers, query, '(user)')
+ this.formatMatchResults(matchingUsers, query, false)
} catch (error) {
console.debug(error)
}
try {
- this.formatMatchResults(matchingGroups, query, '(group)')
+ this.formatMatchResults(matchingGroups, query, true)
} catch (error) {
console.debug(error)
}
diff --git a/src/components/Settings/SettingsAddressbookShare.vue.orig b/src/components/Settings/SettingsAddressbookShare.vue.orig
deleted file mode 100644
index b9d1937a..00000000
--- a/src/components/Settings/SettingsAddressbookShare.vue.orig
+++ /dev/null
@@ -1,197 +0,0 @@
-<!--
- - @copyright Copyright (c) 2018 Team Popcorn <teampopcornberlin@gmail.com>
- -
- - @author Team Popcorn <teampopcornberlin@gmail.com>
- -
- - @license GNU AGPL version 3 or any later version
- -
- - This program is free software: you can redistribute it and/or modify
- - it under the terms of the GNU Affero General Public License as
- - published by the Free Software Foundation, either version 3 of the
- - License, or (at your option) any later version.
- -
- - This program is distributed in the hope that it will be useful,
- - but WITHOUT ANY WARRANTY; without even the implied warranty of
- - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- - GNU Affero General Public License for more details.
- -
- - You should have received a copy of the GNU Affero General Public License
- - along with this program. If not, see <http://www.gnu.org/licenses/>.
- -
--->
-
-<template>
- <div class="addressbook__shares">
- <multiselect
- id="users-groups-search"
- v-model="selectedUserOrGroup"
- :options="usersOrGroups"
-<<<<<<< HEAD
-=======
- :multiple="true"
->>>>>>> refractored api call in share addressbook to use axios all
- :searchable="true"
- :loading="isLoading"
- :internal-search="false"
- :clear-on-select="false"
- :close-on-select="false"
- :options-limit="250"
- :limit="3"
- :max-height="600"
- :show-no-results="false"
-<<<<<<< HEAD
- :placeholder="placeholder"
- open-direction="bottom"
- class="multiselect-vue"
- @search-change="asyncFind">
- <template slot="option" slot-scope="props">
- <span class="">{{ props.option.matchstart }}</span><span class="" style="font-weight: bold;">{{ props.option.matchpattern }}</span><span class="">{{ props.option.matchend }}{{ props.option.matchtag }}</span>
-=======
- :hide-selected="true"
- :placeholder="placeholder"
- open-direction="bottom"
- @search-change="asyncFind">
- <template slot="option" slot-scope="props">
- <span class="">{{ props.option.matchstart }}</span><span class="" style="font-weight: bold;">{{ props.option.matchpattern }}</span><span class="">{{ props.option.matchend }} {{ props.option.matchtag }}</span>
->>>>>>> refractored api call in share addressbook to use axios all
- </template>
- <template slot="clear" slot-scope="props">
- <div v-if="selectedUserOrGroup.length" class="multiselect__clear" @mousedown.prevent.stop="clearAll(props.search)" />
- </template>
- <span slot="noResult">{{ noResult }} </span>
- </multiselect>
- <!-- <pre class="language-json"><code>{{ selectedUserOrGroup }}</code></pre> -->
- <!-- list of user or groups addressbook is shared with -->
- <ul v-if="addressbook.shares.length > 0" class="addressbook__shares__list">
- <address-book-sharee v-for="sharee in addressbook.shares" :key="sharee.name" :sharee="sharee" />
- </ul>
- </div>
-</template>
-
-<script>
-import Multiselect from 'vue-multiselect'
-import addressBookSharee from './SettingsAddressbookSharee'
-
-import clickOutside from 'vue-click-outside'
-import api from '../../services/api'
-
-import clickOutside from 'vue-click-outside'
-import api from '../../services/api'
-
-export default {
- name: 'SettingsShareAddressBook',
- components: {
- clickOutside,
- Multiselect,
- addressBookSharee
- },
- directives: {
- clickOutside
- },
- props: {
- addressbook: {
- type: Object,
- default() {
- return {}
- }
- }
- },
- data() {
- return {
- isLoading: false,
- usersOrGroups: [],
- selectedUserOrGroup: [],
- templateSharee: { displayname: '', writeable: false }
- }
- },
- computed: {
- placeholder() {
- return t('contacts', 'Share with users or groups')
- },
- noResult() {
- return t('contacts', 'Oops! No elements found. Consider changing the search query.')
- }
- },
- methods: {
- addSharee(sharee) {
- let newSharee = {}
- Object.assign({}, this.templateSharee, newSharee)
- // not working yet need to work on!
- this.$store.dispatch('shareAddressbook', newSharee)
- },
-
-<<<<<<< HEAD
- formatMatchResults(matches, query, matchTag) {
- // format response from axios.all and add them to the option array
- /*
- * Case issue for query, matchpattern should reflect case in match not the query
- */
-
-=======
- processMatchResults(matches, query, matchTag) {
->>>>>>> refractored api call in share addressbook to use axios all
- for (let i = 0; i < matches.length; i++) {
- let regex = new RegExp(query, 'i')
- let matchResult = matches[i].split(regex)
- let newMatch = {
- matchstart: matchResult[0],
- matchpattern: query,
- matchend: matchResult[1],
- matchtag: matchTag
- }
- this.usersOrGroups.push(newMatch)
- }
- },
-
- asyncFind(query) {
- this.isLoading = true
- this.usersOrGroups = []
- if (query.length > 0) {
-<<<<<<< HEAD
- api.all([
- api.get(OC.linkToOCS('cloud', 2) + 'users?search=' + query),
- api.get(OC.linkToOCS('cloud', 2) + 'groups?search=' + query)
- ]).then(response => {
- let matchingUsers = response[0].data.ocs.data.users
- let matchingGroups = response[1].data.ocs.data.groups
- try {
- this.formatMatchResults(matchingUsers, query, ' (user)')
-=======
- /*
- * Case issue for query, matchpattern should reflect case in match not the query
- */
-
- api.all([api.get(OC.linkToOCS('cloud', 2) + 'users?search=' + query), api.get(OC.linkToOCS('cloud', 2) + 'groups?search=' + query)]).then(response => {
- let matchingUsers = response[0].data.ocs.data.users
- let matchingGroups = response[1].data.ocs.data.groups
- try {
- this.processMatchResults(matchingUsers, query, '(user)')
->>>>>>> refractored api call in share addressbook to use axios all
- } catch (error) {
- console.debug(error)
- }
- try {
-<<<<<<< HEAD
- this.formatMatchResults(matchingGroups, query, ' (group)')
-=======
- this.processMatchResults(matchingGroups, query, '(group)')
->>>>>>> refractored api call in share addressbook to use axios all
- } catch (error) {
- console.debug(error)
- }
- }).then(() => {
-<<<<<<< HEAD
-
-=======
->>>>>>> refractored api call in share addressbook to use axios all
- this.isLoading = false
- })
- }
- },
-
- clearAll() {
- this.selectedUserOrGroup = []
- }
- }
-}
-</script>
diff --git a/src/components/Settings/SettingsAddressbookSharee.vue b/src/components/Settings/SettingsAddressbookSharee.vue
index 0cccb8b2..60fc832e 100644
--- a/src/components/Settings/SettingsAddressbookSharee.vue
+++ b/src/components/Settings/SettingsAddressbookSharee.vue
@@ -22,7 +22,8 @@
<template>
<li class="addressbook__sharee">
- <span class="icon icon-group" />
+ <span v-if="sharee.group" class="icon icon-group" />
+ <span v-else class="icon icon-user" />
<span class="addressbook__sharee__identifier">{{ sharee.displayname }}</span>
<span class="addressbook__sharee__utils">
<input
diff --git a/src/components/Settings/SettingsNewAddressbook.vue b/src/components/Settings/SettingsNewAddressbook.vue
index 18e2e988..d31fee0e 100644
--- a/src/components/Settings/SettingsNewAddressbook.vue
+++ b/src/components/Settings/SettingsNewAddressbook.vue
@@ -40,7 +40,7 @@
import clickOutside from 'vue-click-outside'
export default {
- name: 'SettingsNewAddressBook',
+ name: 'SettingsNewAddressbook',
components: {
clickOutside
},
diff --git a/src/components/SettingsSection.vue b/src/components/SettingsSection.vue
index f5a8968a..99e2f7c9 100644
--- a/src/components/SettingsSection.vue
+++ b/src/components/SettingsSection.vue
@@ -23,9 +23,9 @@
<template>
<div>
<ul id="address-book-list">
- <address-book v-for="addressbook in addressbooks" :key="addressbook.id" :addressbook="addressbook" />
+ <addressbook v-for="addressbook in addressbooks" :key="addressbook.id" :addressbook="addressbook" />
</ul>
- <add-address-book :addressbooks="addressbooks" />
+ <add-addressbook :addressbooks="addressbooks" />
<import-contacts :addressbooks="addressbooks" class="settings-section" />
<sort-contacts class="settings-section" />
@@ -33,16 +33,16 @@
</template>
<script>
-import addressBook from '../components/Settings/SettingsAddressbook'
-import addAddressBook from '../components/Settings/SettingsNewAddressbook'
+import addressbook from '../components/Settings/SettingsAddressbook'
+import addAddressbook from '../components/Settings/SettingsNewAddressbook'
import importContacts from '../components/Settings/SettingsImportContacts'
import sortContacts from '../components/Settings/SettingsSortContacts'
export default {
name: 'SettingsSection',
components: {
- addressBook,
- addAddressBook,
+ addressbook,
+ addAddressbook,
importContacts,
sortContacts
},
diff --git a/src/services/api.js.orig b/src/services/api.js.orig
deleted file mode 100644
index 511e5321..00000000
--- a/src/services/api.js.orig
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
- *
- * @author John Molakvoæ <skjnldsv@protonmail.com>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-import axios from 'axios'
-
-const requestToken = document.getElementsByTagName('head')[0].getAttribute('data-requesttoken')
-const tokenHeaders = { headers: { requesttoken: requestToken } }
-
-const sanitize = function(url) {
- return url.replace(/\/$/, '') // Remove last url slash
-}
-
-export default {
-
- /**
- * This Promise is used to chain a request that require an admin password confirmation
- * Since chaining Promise have a very precise behavior concerning catch and then,
- * you'll need to be careful when using it.
- * e.g
- * // store
- * action(context) {
- * return api.requireAdmin().then((response) => {
- * return api.get('url')
- * .then((response) => {API success})
- * .catch((error) => {API failure});
- * }).catch((error) => {requireAdmin failure});
- * }
- * // vue
- * this.$store.dispatch('action').then(() => {always executed})
- *
- * Since Promise.then().catch().then() will always execute the last then
- * this.$store.dispatch('action').then will always be executed
- *
- * If you want requireAdmin failure to also catch the API request failure
- * you will need to throw a new error in the api.get.catch()
- *
- * e.g
- * api.requireAdmin().then((response) => {
- * api.get('url')
- * .then((response) => {API success})
- * .catch((error) => {throw error;});
- * }).catch((error) => {requireAdmin OR API failure});
- *
- * @returns {Promise}
- */
- requireAdmin() {
- return new Promise(function(resolve, reject) {
- // TODO: migrate the OC.dialog to Vue and avoid this mess
- // wait for password confirmation
- let passwordTimeout
- let waitForpassword = function() {
- if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
- passwordTimeout = setTimeout(waitForpassword, 500)
- return
- }
- clearTimeout(passwordTimeout)
- clearTimeout(promiseTimeout)
- resolve()
- }
-
- // automatically reject after 5s if not resolved
- let promiseTimeout = setTimeout(() => {
- clearTimeout(passwordTimeout)
- // close dialog
- if (document.getElementsByClassName('oc-dialog-close').length > 0) {
- document.getElementsByClassName('oc-dialog-close')[0].click()
- }
- OC.Notification.showTemporary(t('settings', 'You did not enter the password in time'))
- reject(new Error('Password request cancelled'))
- }, 7000)
-
- // request password
- OC.PasswordConfirmation.requirePasswordConfirmation()
- waitForpassword()
- })
- },
- get(url) {
- return axios.get(sanitize(url), tokenHeaders)
- .then((response) => Promise.resolve(response))
- .catch((error) => Promise.reject(error))
- },
- post(url, data) {
- return axios.post(sanitize(url), data, tokenHeaders)
- .then((response) => Promise.resolve(response))
- .catch((error) => Promise.reject(error))
- },
- patch(url, data) {
- return axios.patch(sanitize(url), data, tokenHeaders)
- .then((response) => Promise.resolve(response))
- .catch((error) => Promise.reject(error))
- },
- put(url, data) {
- return axios.put(sanitize(url), data, tokenHeaders)
- .then((response) => Promise.resolve(response))
- .catch((error) => Promise.reject(error))
- },
- delete(url, data) {
- return axios.delete(sanitize(url), { data: data, headers: tokenHeaders.headers })
- .then((response) => Promise.resolve(response))
- .catch((error) => Promise.reject(error))
-<<<<<<< HEAD
- },
- all(promises) {
- return axios.all(promises)
- .then((response) => Promise.resolve(response))
- .catch((error) => Promise.reject(error))
-
-=======
->>>>>>> added api.js with axios and worked on getting the matching users and groups based on input
- }
-}
diff --git a/src/store/addressbooks.js b/src/store/addressbooks.js
index 0acc946f..b768d72d 100644
--- a/src/store/addressbooks.js
+++ b/src/store/addressbooks.js
@@ -232,8 +232,9 @@ const actions = {
* @param {Object} addressbook Addressbook selected
* @param {Object} sharee Addressbook sharee object
*/
- shareAddressbook(context, [ addressbook, sharee ]) {
+ shareAddressbook(context, [ addressbook, sharee, group ]) {
// Share addressbook with entered group or user
+ context.commit('shareAddressbook', [ addressbook, sharee, group ])
},
/**
diff --git a/src/store/addressbooks.js.orig b/src/store/addressbooks.js.orig
deleted file mode 100644
index 542c927c..00000000
--- a/src/store/addressbooks.js.orig
+++ /dev/null
@@ -1,248 +0,0 @@
-/**
- * @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
- *
- * @author John Molakvoæ <skjnldsv@protonmail.com>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/* eslint-disable-next-line import/no-webpack-loader-syntax */
-import vcfFile from '!raw-loader!./FakeName.vcf'
-import parseVcf from '../services/parseVcf'
-import Vue from 'vue'
-
-import client from '../services/cdav'
-
-const addressbookModel = {
- id: '',
- displayName: '',
- enabled: true,
- owner: '',
- shares: [],
- contacts: {},
- url: ''
-}
-
-const state = {
- addressbooks: []
-}
-
-const mutations = {
-
- /**
- * Add addressbook into state
- *
- * @param {Object} state Default state
- * @param {Object} addressbooks Addressbook
- */
- addAddressbooks(state, addressbook) {
- // extend the addressbook to the default model
- state.addressbooks.push(Object.assign({}, addressbookModel, addressbook))
- },
-
- /**
- * Append a list of contacts to an addressbook
- * and remove duplicates
- *
- * @param {Object} state
- * @param {Object} data
- * @param {Object} data.addressbook the addressbook
- * @param {Contact[]} data.contacts array of contacts to append
- */
- appendContactsToAddressbook(state, { addressbook, contacts }) {
- addressbook = state.addressbooks.find(search => search === addressbook)
-
- // convert list into an array and remove duplicate
- addressbook.contacts = contacts.reduce((list, contact) => {
- if (list[contact.uid]) {
- console.debug('Duplicate contact overrided', list[contact.uid], contact)
- }
- Vue.set(list, contact.uid, contact)
- return list
- }, addressbook.contacts)
- },
-
- /**
- * Add a contact to an addressbook and overwrite if duplicate uid
- *
- * @param {Object} state
- * @param {Contact} contact
- */
- addContactToAddressbook(state, contact) {
- let addressbook = state.addressbooks.find(search => search.id === contact.addressbook.id)
- Vue.set(addressbook.contacts, contact.uid, contact)
- },
-
- /**
- * Delete a contact in a specified addressbook
- *
- * @param {Object} state
- * @param {Contact} contact the contact to delete
- */
- deleteContactFromAddressbook(state, contact) {
- let addressbook = state.addressbooks.find(search => search.id === contact.addressbook.id)
- Vue.delete(addressbook, contact.uid)
- },
-
- /**
- * Share addressbook with a user or group
- *
- * @param {Object} state
- * @param {Object} data
- * @param {Object} data.addressbook the addressbook
- */
- shareAddressbook(state, [ addressbook, sharee ]) {
- addressbook = state.addressbooks.find(search => search === addressbook)
- let newSharee = {}
- newSharee.displayname = sharee
- newSharee.writeable = false
- addressbook.shares.push(newSharee)
- },
-
- /**
- * Remove Share from addressbook shares list
- *
- * @param {Object} state
- * @param {Object} data
- * @param {Object} data.addressbook the addressbook
- */
- removeSharee(state, sharee) {
- let addressbook = state.addressbooks.find(search => {
- for (let i in search.shares) {
- if (search.shares[i] === sharee) {
- return true
- }
- }
- })
- addressbook.shares.splice(addressbook.shares.indexOf(sharee), 1)
- },
-
- /**
- * Toggle sharee's writable permission
- *
- * @param {Object} state
- * @param {Object} data
- * @param {Object} data.addressbook the addressbook
- * @param {Object} sharee the sharee
- */
- updateShareeWritable(state, sharee) {
- let addressbook = state.addressbooks.find(search => {
- for (let i in search.shares) {
- if (search.shares[i] === sharee) {
- return true
- }
- }
- })
- sharee = addressbook.shares.find(search => search === sharee)
- sharee.writeable = !sharee.writeable
- }
-
-}
-
-const getters = {
- getAddressbooks: state => state.addressbooks
-}
-
-const actions = {
-
- /**
- * Retrieve and commit addressbooks
- *
- * @param {Object} context
- * @returns {Promise} fetch and commit
- */
- async getAddressbooks(context) {
- let addressbooks = client.addressbookHomes.map(addressbook => {
- return {
- id: 'ab1',
- displayName: 'Addressbook 1',
- enabled: true,
- owner: 'admin',
- dav: addressbook
- }
- })
- addressbooks.forEach(addressbook => {
- context.commit('addAddressbooks', addressbook)
- })
- return addressbooks
- },
-
- /**
- * Retrieve the contacts of the specified addressbook
- * and commit the results
- *
- * @param {Object} context
- * @param {Object} addressbook
- */
- async getContactsFromAddressBook(context, addressbook) {
- let contacts = parseVcf(vcfFile, addressbook)
- context.commit('appendContactsToAddressbook', { addressbook, contacts })
- context.commit('appendContacts', contacts)
- context.commit('sortContacts')
- context.commit('appendGroupsFromContacts', contacts)
- },
-
- /**
- * Remove sharee from Addressbook
- * @param {Object} context Current context
- * @param {Object} sharee Addressbook sharee object
- */
- removeSharee(context, sharee) {
- // Remove sharee from addressbook.
- context.commit('removeSharee', sharee)
- },
-
- /**
- * Toggle permissions of Addressbook Sharees writeable rights
- * @param {Object} context Current context
- * @param {Object} sharee Addressbook sharee object
- */
- toggleShareeWritable(context, sharee) {
- // Toggle sharee edit permissions.
- context.commit('updateShareeWritable', sharee)
- },
-
- /**
- * Share Adressbook with User or Group
- * @param {Object} context Current context
- * @param {Object} addressbook Addressbook selected
- * @param {Object} sharee Addressbook sharee object
- */
- shareAddressbook(context, [ addressbook, sharee ]) {
- // Share addressbook with entered group or user
-<<<<<<< HEAD
- },
-
- /**
- * Move a contact to the provided addressbook
- *
- * @param {Object} context
- * @param {Object} data
- * @param {Contact} data.contact
- * @param {Object} data.addressbook
- */
- moveContactToAddressbook(context, { contact, addressbook }) {
- context.commit('deleteContactFromAddressbook', contact)
- context.commit('updateContactAddressbook', { contact, addressbook })
- context.commit('addContactToAddressbook', contact)
-=======
- context.commit('shareAddressbook', [ addressbook, sharee ])
->>>>>>> working version of shareAdressbook, adds sharees to addressbook object
- }
-}
-
-export default { state, mutations, getters, actions }