refactor: simplify user profile to username-only state#1587
Conversation
|
Docker image build succeeded: quay.io/eclipse/che-dashboard:pr-1587 (linux/amd64, linux/arm64) kubectl patch commandkubectl patch -n eclipse-che "checluster/eclipse-che" --type=json -p="[{"op": "replace", "path": "/spec/components/dashboard/deployment", "value": {containers: [{image: "quay.io/eclipse/che-dashboard:pr-1587", name: che-dashboard}]}}]" |
olexii4
left a comment
There was a problem hiding this comment.
The idea is correct — switching away from reading the user-profile secret during concurrent writes makes sense. But there are a couple of things that need to be addressed.
The gravatar-url package generates image URLs by hashing an email address. Passing a username instead of an email will never match any real Gravatar account — every user will get the same generated fallback avatar. So removing email from the profile breaks the avatar in the header. The Avatar component needs to be redesigned with this in mind — either use initials, a generic user icon, or find another way to get the email.
Also, the old code had {isUserAuthenticated && (...)} guards around UserMenu and Avatar. Those are gone now, so both components always render — including during bootstrap when the username is still 'unknown'. That needs to be handled somehow.
My suggestion: instead of merging this PR, let's look at #1569 and fix it there. The original approach of reading the user-profile secret is fine — the only problem is the race condition on high-load clusters. That can be handled by adding a short delay and a few retries before giving up. That way we keep the email, the Gravatar works, and we don't need che-server#1018 to land first.
@vinokurig @akurinnoy what do you think?
@vinokurig thanks, that settles it. If the email was always That makes me think we should just remove the
Concretely, remove from -import gravatarUrl from 'gravatar-url';
...
- const imageUrl = email ? gravatarUrl(email, { default: 'retro' }) : '';
- const isUserAuthenticated = !!email;
...
- {isUserAuthenticated && (
- <ToolbarItem>
- <Avatar src={imageUrl} alt="Avatar image" size="md" />
- </ToolbarItem>
- )}@ibuziuk @svor — thoughts on dropping the |
|
IMO it makes sense to remove the avatar since it doesn't provide any functionality or useful information - it's just a default icon. It would also make the UI more consistent with the OpenShift console. |
Remove unused user profile backend endpoints and rename User.Profile store to User.Name to reflect that it only manages the username. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
Docker image build succeeded: quay.io/eclipse/che-dashboard:pr-1587 (linux/amd64, linux/arm64) kubectl patch commandkubectl patch -n eclipse-che "checluster/eclipse-che" --type=json -p="[{"op": "replace", "path": "/spec/components/dashboard/deployment", "value": {containers: [{image: "quay.io/eclipse/che-dashboard:pr-1587", name: che-dashboard}]}}]" |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: olexii4, svor, vinokurig The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/retest |
|
Hi! I'm che-ai-assistant — I help with your pull requests. Available commands:
|
|
/retest |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1587 +/- ##
========================================
Coverage 92.52% 92.52%
========================================
Files 563 561 -2
Lines 56291 56153 -138
Branches 4278 4275 -3
========================================
- Hits 52084 51957 -127
+ Misses 4157 4146 -11
Partials 50 50 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|

What does this PR do?
In some circumstances, e.g., a high-load OpenShift cluster, creating or updating a Kubernetes secret may take some time (it is not instant). If reading the
user-profilesecret occurs during the create or update operation of the secret, an error is thrown. In order to avoid this race condition, request the user from theche-serverAPI instead of reading theuser-profilesecret directly.Removed the full user profile API endpoint and state management in favor of a simpler username-only approach. The previous IUserProfile interface contained both email and username, but only username was actively used throughout the application.
Changes:
Screenshot/screencast of this PR
What issues does this PR fix or reference?
https://redhat.atlassian.net/browse/CRW-10682
Is it tested? How?
N/A
Release Notes
Docs PR