From 5010c7c1173659e6a0b4aa535d8119f592e3fa25 Mon Sep 17 00:00:00 2001 From: silver Date: Thu, 9 Jul 2026 08:53:44 +0200 Subject: [PATCH 1/2] fix(router): redirect profile details view to internal contacts list Signed-off-by: silver Assisted-by: ClaudeCode:claude-sonnet-5 --- src/router/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/router/index.js b/src/router/index.js index 4913933020..ade98f3c07 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -4,9 +4,10 @@ */ import { generateUrl } from '@nextcloud/router' +import { Buffer } from 'buffer' 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' // 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: Buffer.from(`${to.params.userId}~z-server-generated--system`, 'utf8').toString('base64'), + }, + }), + }, ], }, ], From fde21b48c6222b3f8f66a4f961ae2804484ec6ec Mon Sep 17 00:00:00 2001 From: silver Date: Tue, 14 Jul 2026 08:39:43 +0200 Subject: [PATCH 2/2] fix(router): refactor the generating of a contact key Code proposed by @cristianscheid Signed-off-by: silver --- src/models/contact.js | 6 +++++- src/router/index.js | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) 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 ade98f3c07..0329de418a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -4,10 +4,10 @@ */ import { generateUrl } from '@nextcloud/router' -import { Buffer } from 'buffer' import { createRouter, createWebHistory } from 'vue-router' import Contacts from '../views/Contacts.vue' 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 @@ -65,7 +65,7 @@ export default createRouter({ name: 'contact', params: { selectedGroup: GROUP_ALL_CONTACTS, - selectedContact: Buffer.from(`${to.params.userId}~z-server-generated--system`, 'utf8').toString('base64'), + selectedContact: generateContactKey(to.params.userId, 'z-server-generated--system'), }, }), },