Skip to content

Commit 4b1cc2a

Browse files
authored
Merge pull request #5578 from nextcloud/backport/5556/stable8.3
[stable8.3] fix(router): redirect profile details view to internal contacts list
2 parents 2602e12 + 062d1c4 commit 4b1cc2a

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/models/contact.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ export const MinimalContactProperties = [
2828
'EMAIL', 'UID', 'TEL', 'CATEGORIES', 'FN', 'ORG', 'N', 'X-PHONETIC-FIRST-NAME', 'X-PHONETIC-LAST-NAME', 'X-MANAGERSNAME', 'TITLE', 'NOTE', 'RELATED',
2929
].concat(ContactKindProperties)
3030

31+
export function generateContactKey(uid, addressbookId) {
32+
return Buffer.from(uid + '~' + addressbookId, 'utf8').toString('base64')
33+
}
34+
3135
export default class Contact {
3236
/**
3337
* Creates an instance of Contact
@@ -198,7 +202,7 @@ export default class Contact {
198202
* @memberof Contact
199203
*/
200204
get key() {
201-
return Buffer.from(this.uid + '~' + this.addressbook.id, 'utf8').toString('base64')
205+
return generateContactKey(this.uid, this.addressbook.id)
202206
}
203207

204208
/**

src/router/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import { generateUrl } from '@nextcloud/router'
77
import { createRouter, createWebHistory } from 'vue-router'
88
import Contacts from '../views/Contacts.vue'
9-
import { ROUTE_CHART, ROUTE_CIRCLE, ROUTE_USER_GROUP } from '../models/constants.ts'
9+
import { GROUP_ALL_CONTACTS, ROUTE_CHART, ROUTE_CIRCLE, ROUTE_USER_GROUP } from '../models/constants.ts'
10+
import { generateContactKey } from '../models/contact.js'
1011

1112
// if index.php is in the url AND we got this far, then it's working:
1213
// let's keep using index.php in the url
@@ -57,6 +58,17 @@ export default createRouter({
5758
name: 'user_group',
5859
component: Contacts,
5960
},
61+
{
62+
path: 'u/:userId',
63+
name: 'profile-redirect',
64+
redirect: (to) => ({
65+
name: 'contact',
66+
params: {
67+
selectedGroup: GROUP_ALL_CONTACTS,
68+
selectedContact: generateContactKey(to.params.userId, 'z-server-generated--system'),
69+
},
70+
}),
71+
},
6072
],
6173
},
6274
],

0 commit comments

Comments
 (0)