Skip to content

fix(router): redirect profile details view to internal contacts list#5556

Open
silverkszlo wants to merge 1 commit into
mainfrom
fix/navigate-to-userprofile
Open

fix(router): redirect profile details view to internal contacts list#5556
silverkszlo wants to merge 1 commit into
mainfrom
fix/navigate-to-userprofile

Conversation

@silverkszlo

@silverkszlo silverkszlo commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #5554

The bug

When inside the Contacts app one goes to > Teams > some team > some member > "View profile", the user does not get navigated to the clicked user's profile but to the general "All contacts" list and the following errors appear:
Screenshot from 2026-07-09 08-56-10

What seems to be the cause

  • The "View profile" link is generated server-side and used by NcAvatar. And NcAvatar only checks if the link matches any route in the current app's router.
  • Contacts app's router uses :selectedGroup/:selectedContact with no literal prefix, so it matches any two-segment path and treats /u/alice like an internal path (but it's not)
  • To navigate to the Contact's internal contacts list it should navigate to cloud.host.com/apps/contacts/All%20contacts/[someLongbase64String]
Screenshot from 2026-07-09 09-30-44

The solution

  • Add a profile-redirect in Contacts app's router for u/:userId and build the correct url

That solution seems like a workaround though. Maybe :selectedGroup/:selectedContact should be less permissive or the NcAvatar needs an adjustment?

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/router/index.js 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Signed-off-by: silver <s.szmajduch@posteo.de>

Assisted-by: ClaudeCode:claude-sonnet-5
@silverkszlo silverkszlo force-pushed the fix/navigate-to-userprofile branch from ffa501a to 3bb2f91 Compare July 9, 2026 07:36
@ChristophWurst ChristophWurst added the feature: teams ex circles label Jul 9, 2026
Comment thread src/router/index.js
name: 'contact',
params: {
selectedGroup: GROUP_ALL_CONTACTS,
selectedContact: Buffer.from(`${to.params.userId}~z-server-generated--system`, 'utf8').toString('base64'),

@cristianscheid cristianscheid Jul 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the logic to generate the contact key is the same from src/models/contact::key() method.

To avoid duplication, maybe we could extract the logic into a function and use it in both places? Maybe something like:

// src/models/contact.js

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

export default class Contact {
	{...}
	get key() {
		return generateContactKey(this.uid, this.addressbook.id)
	}


// src/router/index.js

{...}
import { generateContactKey } from '../models/contact.js'
{...}
export default createRouter({
{...}
				{
					path: 'u/:userId',
					name: 'profile-redirect',
					redirect: (to) => ({
						name: 'contact',
						params: {
							selectedGroup: GROUP_ALL_CONTACTS,
							selectedContact: generateContactKey(to.params.userId, 'z-server-generated--system'),
						},
					}),
				},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: teams ex circles

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"View profile" for team members is broken

3 participants