Repository navigation
fix: avatar initials - #66517
fix: avatar initials#66517kristian-zendato wants to merge 2 commits into
Conversation
|
@kristian-zendato Thank you so much for working on this! Could you imagine looking into the display name/greeting part of #46878 as well? For example, by ensuring that the display name is used in the greeting, as long as the user (or admin) has explicitly set it – regardless of whether it is in upper or lower case or is identical to the user ID. For us, this currently means that our accounts are losing their personalised welcoming touch, as the user ID and the display name set in the profile are the same. |
Signed-off-by: kristian-zendato <kristian.zendato@nextcloud.com>
Signed-off-by: kristian-zendato <kristian.zendato@nextcloud.com>
cb8c411 to
202e85d
Compare
|
@4jNsY6fCVqZv I updated the code for your comment. Here is what I did for it.
|
|
That sounds wonderful! Thank you so much! Does it matter, if the display name was set deliberately by the user in their profile, or by an admin when the account was created? Would you mind updating the title of the PR so that it reflects both aspects? And could you even imagine a backport to version 34/35? |
@4jNsY6fCVqZv Here are the scenarios when displayName is set explicitly.
Backport will be done once the PR is approved. |
| if (preg_match('/\p{Hangul}/u', $character) === 1) { | ||
| return __DIR__ . '/../../../core/fonts/NotoSansKR-Regular.ttf'; | ||
| } | ||
| if (preg_match('/[\p{Hiragana}\p{Katakana}]/u', $character) === 1) { | ||
| return __DIR__ . '/../../../core/fonts/NotoSansJP-Regular.ttf'; | ||
| } | ||
| if (preg_match('/\p{Han}/u', $character) === 1) { | ||
| return __DIR__ . '/../../../core/fonts/NotoSansJP-Regular.ttf'; |
There was a problem hiding this comment.
Why not do the preg_match directly on the whole username? Why loop on each character?
There was a problem hiding this comment.
Let's imagine a scenario for a username with different language.
Of course, it is rare case, but when a Japanese live in Germany can set their username in both Japanese and German.
In that case, we need to select proper font for each character.
come-nc
left a comment
There was a problem hiding this comment.
This whole display label thing is overengineered.
Why is the display name logic not working? We should not add a second field for the same thing.
|
Regarding uppercase vs lowercase I would need a review from design as this change would be a design decision @marcoambrosini |
pringelmann
left a comment
There was a problem hiding this comment.
Agree with @come-nc on overengineering. The column already knows if we have a name: it's NULL until something is set. It only stops knowing because clearing it writes the uid into it. If clearing stored an empty value instead, the column is the single source of truth and we only need a small way to read it, not a second config key. Maybe this could solve the problem more simply?
Also, please split the avatar changes out into separate PR? The casing change still needs a design decision, and imo it shouldn't block or ride along with a backport of the greeting fix.
|
I totally agree with that adding second config key is not a good solution for this. Here are some examples of them.
To reduce this side-effects, I introduced a new variable called Could you suggest me any better idea for the side-effects please? |
Sorry maybe my suggestion was too imprecise: getDisplayName() itself wouldn't need to change. It already falls back to the uid when the column is empty, and every account created without a name already has NULL there today. Clearing would simply restore that state. setDisplayName() has to allow The open question is still how the dashboard learns no name was set. I'd keep that small and non-public instead of a new IUser method plus a config key. |
202e85d to
2f76db5
Compare
|
Split explicit displayName part to #66796 |
Summary
Screenshots
Checklist
3. to review, feature component)stable32)AI (if applicable)