Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/mixins/RouterMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { ROUTE_CIRCLE, ROUTE_USER_GROUP } from '../models/constants.ts'

export default {
computed: {
// router variables
selectedContact() {
return this.$route.params.selectedContact
},
selectedGroup() {
const { name } = this.$route
if (name === 'circle') {
return ROUTE_CIRCLE
}
if (name === 'user_group') {
return ROUTE_USER_GROUP
}
return this.$route.params.selectedGroup
},
selectedCircle() {
Expand Down
15 changes: 12 additions & 3 deletions src/views/Contacts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export default {

methods: {
async newContact() {
if (this.isCirclesView) {
if (this.selectedCircle) {
emit('contacts:circles:append', this.selectedCircle.id)
return
}
Expand Down Expand Up @@ -314,7 +314,14 @@ export default {

// set group if it's selected already
// 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) {
if (
![
GROUP_ALL_CONTACTS,
GROUP_NO_GROUP_CONTACTS,
ROUTE_CIRCLE,
ROUTE_USER_GROUP,
].includes(this.selectedGroup)
) {
contact.groups = [this.selectedGroup]
}
try {
Expand All @@ -323,7 +330,9 @@ export default {
await this.$router.push({
name: 'contact',
params: {
selectedGroup: this.selectedGroup,
selectedGroup: this.selectedUserGroup
? GROUP_ALL_CONTACTS
: this.selectedGroup,
selectedContact: contact.key,
},
})
Expand Down