diff --git a/src/models/contact.js b/src/models/contact.js index 325b641c8f..ee780bb51c 100644 --- a/src/models/contact.js +++ b/src/models/contact.js @@ -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 @@ -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) } /** diff --git a/src/router/index.js b/src/router/index.js index 4913933020..0329de418a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -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 @@ -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'), + }, + }), + }, ], }, ],