summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJessica <jessica@Absolventas-MacBook-Pro.local>2018-08-22 15:28:10 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-08-28 15:51:41 +0200
commit2cc60e1f6a73306f8822f17a057437c8bd340289 (patch)
tree510fe0ec4202a36aba6dfed88e1dcce003737c4d /src
parentf0b45a274bcd9209ca8af614f0a23ad1e6f33778 (diff)
made additional changes for PR.
Diffstat (limited to 'src')
-rw-r--r--src/components/Settings/SettingsAddressbookShare.vue30
-rw-r--r--src/components/Settings/SettingsAddressbookSharee.vue3
-rw-r--r--src/components/SettingsSection.vue4
-rw-r--r--src/store/addressbooks.js4
4 files changed, 22 insertions, 19 deletions
diff --git a/src/components/Settings/SettingsAddressbookShare.vue b/src/components/Settings/SettingsAddressbookShare.vue
index dc7085e0..f64c5df5 100644
--- a/src/components/Settings/SettingsAddressbookShare.vue
+++ b/src/components/Settings/SettingsAddressbookShare.vue
@@ -123,19 +123,23 @@ export default {
let regex = new RegExp(query, 'i')
let existingSharees = this.addressbook.shares.map(share => share.id + share.group)
matches = matches.filter(share => existingSharees.indexOf(share.id + group) === -1)
- for (let i = 0; i < matches.length; i++) {
- let matchResult = matches[i].displayname.split(regex)
- let newMatch = {
- sharee: matches[i].displayname,
- id: matches[i].id,
+ // this.usersOrGroups.concat(
+ this.usersOrGroups = this.usersOrGroups.concat(matches.map(match => {
+ let matchResult = match.displayname.split(regex)
+ if (matchResult.length < 1) {
+ return
+ }
+ return {
+ sharee: match.displayname,
+ id: match.id,
matchstart: matchResult[0],
- matchpattern: matches[i].displayname.match(regex)[0],
+ matchpattern: match.displayname.match(regex)[0],
matchend: matchResult[1],
matchtag: group ? '(group)' : '(user)',
- group: group
+ group
}
- this.usersOrGroups.push(newMatch)
- }
+ }))
+ console.log(this.usersOrGroups) // eslint-disable-line
},
/**
@@ -143,7 +147,7 @@ export default {
*
* @param {String} query
*/
- asyncFind(query) {
+ asyncFind: debounce(function(query) {
this.isLoading = true
this.usersOrGroups = []
if (query.length > 0) {
@@ -154,12 +158,12 @@ export default {
let matchingUsers = Object.values(response[0].data.ocs.data.users)
let matchingGroups = response[1].data.ocs.data.groups
try {
- debounce(this.formatMatchResults(matchingUsers, query, false), 250, true)
+ this.formatMatchResults(matchingUsers, query, false)
} catch (error) {
console.debug(error)
}
try {
- debounce(this.formatMatchResults(matchingGroups, query, true), 250, true)
+ this.formatMatchResults(matchingGroups, query, true)
} catch (error) {
console.debug(error)
}
@@ -171,7 +175,7 @@ export default {
} else {
this.inputGiven = false
}
- }
+ }, 500)
}
}
</script>
diff --git a/src/components/Settings/SettingsAddressbookSharee.vue b/src/components/Settings/SettingsAddressbookSharee.vue
index 60fc832e..dcb00d03 100644
--- a/src/components/Settings/SettingsAddressbookSharee.vue
+++ b/src/components/Settings/SettingsAddressbookSharee.vue
@@ -22,8 +22,7 @@
<template>
<li class="addressbook__sharee">
- <span v-if="sharee.group" class="icon icon-group" />
- <span v-else class="icon icon-user" />
+ <span :class="sharee.group ? 'icon-group' : 'icon-user'" class="icon" />
<span class="addressbook__sharee__identifier">{{ sharee.displayname }}</span>
<span class="addressbook__sharee__utils">
<input
diff --git a/src/components/SettingsSection.vue b/src/components/SettingsSection.vue
index ffd8ef63..d3248a70 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" />
+ <address-book v-for="addressbook in addressbooks" :key="addressbook.id" :addressbook="addressbook" />
</ul>
- <add-address-Book :addressbooks="addressbooks" />
+ <add-address-book :addressbooks="addressbooks" />
<import-contacts :addressbooks="addressbooks" class="settings-section" />
<sort-contacts class="settings-section" />
diff --git a/src/store/addressbooks.js b/src/store/addressbooks.js
index 171dfc34..ed2e03c6 100644
--- a/src/store/addressbooks.js
+++ b/src/store/addressbooks.js
@@ -112,9 +112,9 @@ const mutations = {
addressbook = state.addressbooks.find(search => search.id === addressbook.id)
let newSharee = {
displayname: sharee,
- id: id,
+ id,
writeable: false,
- group: group
+ group
}
addressbook.shares.push(newSharee)
},