From cad9ce3b813e83e0b4175997829e10704bc9141b Mon Sep 17 00:00:00 2001 From: Jessica Date: Mon, 20 Aug 2018 18:10:07 +0200 Subject: updated scss files to include copyright and only linked in oen file --- src/store/addressbooks.js.orig | 285 ----------------------------------------- 1 file changed, 285 deletions(-) delete mode 100644 src/store/addressbooks.js.orig (limited to 'src') diff --git a/src/store/addressbooks.js.orig b/src/store/addressbooks.js.orig deleted file mode 100644 index 141b8b31..00000000 --- a/src/store/addressbooks.js.orig +++ /dev/null @@ -1,285 +0,0 @@ -/** - * @copyright Copyright (c) 2018 John Molakvoæ - * - * @author John Molakvoæ - * - * @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 . - * - */ - -/* 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 - * @param {String} data.sharee the sharee - * @param {Boolean} data.group group - */ -<<<<<<< HEAD - shareAddressbook(state, [ addressbook, sharee ]) { - addressbook = state.addressbooks.find(search => search === addressbook) -======= - shareAddressbook(state, { addressbook, sharee, group }) { - addressbook = state.addressbooks.find(search => search.id === addressbook.id) ->>>>>>> refractored and changed comments, fixed bug with search for sharees function - let newSharee = {} - newSharee.displayname = sharee - newSharee.writeable = false - addressbook.shares.push(newSharee) - }, - - /** - * Remove Sharee from addressbook shares list - * - * @param {Object} state - * @param {Object} sharee the sharee - */ - 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} 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', -<<<<<<< HEAD - dav: addressbook -======= - shares: [], - contacts: {} - }, - { - id: 'ab2', - displayName: 'Addressbook 2', - enabled: false, - owner: 'admin', - shares: [], - contacts: {} - }, - { - id: 'ab3', - displayName: 'Addressbook 3', - enabled: true, - owner: 'User1', - shares: [], - contacts: {} ->>>>>>> refractored and changed comments, fixed bug with search for sharees function - } - ] - // fake request - return new Promise((resolve, reject) => { - return setTimeout(() => { - addressbooks.forEach(addressbook => { - context.commit('addAddressbooks', addressbook) - }) - resolve() - return addressbooks - }, 1000) - }) - 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} data.addressbook the addressbook - * @param {String} data.sharee the sharee - * @param {Boolean} data.group group - */ - shareAddressbook(context, { addressbook, sharee, group }) { - // Share addressbook with entered group or user -<<<<<<< HEAD - context.commit('shareAddressbook', [ addressbook, sharee, group ]) - }, - - /** - * 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, group }) ->>>>>>> refractored and changed comments, fixed bug with search for sharees function - } -} - -export default { state, mutations, getters, actions } -- cgit v1.2.3