-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Change how identities are shown in commit page #24087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I was going to just send this to Forgejo, but it'd end up here eventually, so. I am linking the previous PR as it shows some additional context regarding the decision as to how I chose how the names are going to be displayed to the user. I hope that this looks visually better / more informational than in other forges. |
The following is an image reference using my actual settings as I have them on various instances. I can see where this could be beneficial, but it almost seems like there should be a check on whether the names match, in which case it could just use one. i.e. |
We should unify the way author name is display. Sometimes it's username, sometimes it's full name, sometimes it's both. I'd say always display full name if present. If full name and username match, display only full name. A custom render function will be needed. |
I tried to consider the following behind my design:
|
ACK. |
The easier way is to use a template like: https://github.com/go-gitea/gitea/blob/main/templates/repo/search_name.tmpl The "name displaying" logic usually is:
At the moment the Gitea's name displaying is not clear / not consistent, that's a historical problem. If you think If you prefer your current approach, it could also look good. (I think I will do some "name displaying" refactoring in following PRs ....... 😄 ) |
Well, I also think that having way too many places with different ideas as to how a name should be shown is a bit cursed, but I think it'd make sense to get a bit more verbose in commit pages. The goal is to push the state of the UI towards a better direction (and not just introduce more edge cases and confusing inconsistencies) but I am not exactly sure what to do here without essentially having my hand held so as to fix this problem for good. There's also the name of the owner of the key that a commit was signed with, which is not really shown everywhere. |
I am also not sure how to deal with the committer case. Can their username be discovered somehow? |
I haven't understood the question "discover the username". If I understand correctly, if the |
This is the part that has managed to confuse me very much, |
I think I somewhat understand these variables now. The details are in
|
I just glanced over the code, thank you for the hints and the help here. So, just to be sure, is it true that we can't correlate committers and their respective on-platform usernames as things are right now? |
If the commit user can be found in Gitea's database (hmm, many more details, eg: by email, by key) as a site user, then these two "names" are correlated. Otherwise, not correlated because no clue to correlate them. |
Hi, I am not sure if I can implement all that by myself because of a personal lack of experience and a hesitance of dealing with PII like this... Small edit: I am still unsure how "exposing" variables in a template, I think this is beyond my current skill level. |
I think this PR could help you: Add a helper function dumpVar to help debugging and development #24262 (at least, we can know what variable type it is) |
The username is now always shown next to full names. The commit information should use the full name associated with the commit and the signature information should use the full name associated with the profile, provided that it exists. This should remove any confusion if the author decides to use different names under the same account at a later point in time.
62b0716
to
8aabc2f
Compare
Most of the things I typed out earlier regarding "committers being completely ignored" were wrong. I managed to figure out how the template works in greater detail by playing around with the code, breaking things, then undoing those things only to realize that the features that I described as "missing" existed in the first place. Anyways, this latest push is on top of the latest revision of the tree and ensures that Committers will follow the same format: Full Name As Stored In Examined Resource (Username) (excluding PGP key name, which uses Forgejo profile name instead) The matching name + username case was considered in this case too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally L-G-T-M.
Could we have some inline comments about the types of each variable? eg:
{{/* .Author: User model */}}
{{/* .Commit.Author: modules/git/Commit, modules/git/Signature */}}
{{/* .Verification.SigningUser: modules/git/CommitVerification, User model */}}
It would help future developers a lot.
Co-authored-by: wxiaoguang <[email protected]>
@wxiaoguang Apart from the comment that I haven't addressed at all yet (the logic behind this PR is extremely hard to follow if you haven't extensively worked with it over the past 24 hours to me), do you have any suggestions as to how my approach could be done in a cleaner manner? |
Sorry I have no idea at the moment (I haven't got enough time and I haven't had enough understanding for this problem yet). I might take a look in the future if I have enough time but I can't guarantee at the moment. So I hide my reviews. If other reviewers have ideas or approve, feel free to continue. Thank you. |
I tried to read the code again, I think it could be like this: fix name display n0toose#1 |
fix name display
Blindly merged for now, I'll get back to this at a later point (this is still on my radar). |
Found some problems in my code, so added a new commit to fix them, and added some comments, I think the "user name" will be rendered in the following formats now:
|
Really sorry for taking up your time with this earlier (thank you nevertheless!), but I think that I lack the time and concentration to actually solve this problem properly right now. I think that a better approach would be modifying the If I am to pick this up again (which I remain interested in, just not interested enough to do this right now), I will do so in a new PR (maybe with a much more limited scope for starters). For now, I'll leave the space for someone else to do this, just in case this person appears. |
The username is now always shown next to full names. The commit
information should use the full name associated with the commit and the
signature information should use the full name associated with the
profile, provided that it exists.
This should remove any confusion if the author decides to use different
names under the same account at a later point in time.
In some cases, the full names shown in specific fields may differ from
the profile's full name, as some other metadata may be preferred
instead.