diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-03-25 09:29:22 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-03-25 09:29:22 +0100 |
commit | c14a47c787f3f610d309d71b9e7ab68904048441 (patch) | |
tree | c27697ec01cd7a4c421e12fc510272c907c6d744 /src | |
parent | ad7b7dfca116c0cffba97bb11e894ffde3c53090 (diff) |
Do not add `not grouped` to the new contacts groups
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/views/Contacts.vue | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/views/Contacts.vue b/src/views/Contacts.vue index 5e6d31de..0d06da42 100644 --- a/src/views/Contacts.vue +++ b/src/views/Contacts.vue @@ -83,6 +83,9 @@ import rfcProps from 'Models/rfcProps' import client from 'Services/cdav' +const GROUP_ALL_CONTACTS = t('contacts', 'All contacts') +const GROUP_NO_GROUP_CONTACTS = t('contacts', 'Not grouped') + export default { name: 'Contacts', @@ -158,9 +161,9 @@ export default { * @returns {Array} */ contactsList() { - if (this.selectedGroup === t('contacts', 'All contacts')) { + if (this.selectedGroup === GROUP_ALL_CONTACTS) { return this.sortedContacts - } else if (this.selectedGroup === t('contacts', 'Not grouped')) { + } else if (this.selectedGroup === GROUP_NO_GROUP_CONTACTS) { return this.ungroupedContacts.map(contact => this.sortedContacts.find(item => item.key === contact.key)) } let group = this.groups.filter(group => group.name === this.selectedGroup)[0] @@ -214,9 +217,9 @@ export default { icon: 'icon-contacts-dark', router: { name: 'group', - params: { selectedGroup: t('contacts', 'All contacts') } + params: { selectedGroup: GROUP_ALL_CONTACTS } }, - text: t('contacts', 'All contacts'), + text: GROUP_ALL_CONTACTS, utils: { counter: this.sortedContacts.length } @@ -234,9 +237,9 @@ export default { icon: 'icon-user', router: { name: 'group', - params: { selectedGroup: t('contacts', 'Not grouped') } + params: { selectedGroup: GROUP_NO_GROUP_CONTACTS } }, - text: t('contacts', 'Not grouped'), + text: GROUP_NO_GROUP_CONTACTS, utils: { counter: this.ungroupedContacts.length } @@ -321,8 +324,10 @@ export default { } } } + // set group if it's selected already - if (this.selectedGroup !== t('contacts', 'All contacts')) { + // BUT NOT if it's the _fake_ groups like all contacts and not grouped + if ([GROUP_ALL_CONTACTS, GROUP_NO_GROUP_CONTACTS].indexOf(this.selectedGroup) === -1) { contact.groups = [ this.selectedGroup ] } try { |