Skip to content
Merged
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
6 changes: 5 additions & 1 deletion src/models/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export const MinimalContactProperties = [
'EMAIL', 'UID', 'TEL', 'CATEGORIES', 'FN', 'ORG', 'N', 'X-PHONETIC-FIRST-NAME', 'X-PHONETIC-LAST-NAME', 'X-MANAGERSNAME', 'TITLE', 'NOTE', 'RELATED',
].concat(ContactKindProperties)

export function generateContactKey(uid, addressbookId) {
return Buffer.from(uid + '~' + addressbookId, 'utf8').toString('base64')
}

export default class Contact {
/**
* Creates an instance of Contact
Expand Down Expand Up @@ -211,7 +215,7 @@ export default class Contact {
* @memberof Contact
*/
get key() {
return Buffer.from(this.uid + '~' + this.addressbook.id, 'utf8').toString('base64')
return generateContactKey(this.uid, this.addressbook.id)
}

/**
Expand Down
14 changes: 13 additions & 1 deletion src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import { generateUrl } from '@nextcloud/router'
import { createRouter, createWebHistory } from 'vue-router'
import Contacts from '../views/Contacts.vue'
import { ROUTE_CHART, ROUTE_CIRCLE, ROUTE_USER_GROUP } from '../models/constants.ts'
import { GROUP_ALL_CONTACTS, ROUTE_CHART, ROUTE_CIRCLE, ROUTE_USER_GROUP } from '../models/constants.ts'
import { generateContactKey } from '../models/contact.js'

// if index.php is in the url AND we got this far, then it's working:
// let's keep using index.php in the url
Expand Down Expand Up @@ -57,6 +58,17 @@ export default createRouter({
name: 'user_group',
component: Contacts,
},
{
path: 'u/:userId',
name: 'profile-redirect',
redirect: (to) => ({
name: 'contact',
params: {
selectedGroup: GROUP_ALL_CONTACTS,
selectedContact: generateContactKey(to.params.userId, 'z-server-generated--system'),
},
}),
},
],
},
],
Expand Down
Loading