Skip to content
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

De-emphasize signed commits #31160

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

BlenderDefender
Copy link
Contributor

@BlenderDefender BlenderDefender commented May 29, 2024

This pull request changes how signed commits are displayed, as signed commits were emphasized too much previously. This includes a rewrite of the commit list UI, which now uses an unordered list instead of a table. If a commit is signed, a clickable badge is shown, indicating that the commit is signed with either a verified or an unverified signature.

fixes #29641


Comparison:

Latest commit

Before

grafik

After

grafik

Commit list

Before

grafik

After

grafik

Commit details

Before

grafik

After

grafik
grafik

Commit Graph

Before

grafik

After

grafik

Clicking on the badge opens the following modal:
grafik
grafik
grafik

Rework the signed commits UI to show a clickable badge for signed commits. Clicking this badge reveals further information about the trust status of the signature.
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 29, 2024
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 29, 2024
@github-actions github-actions bot added the modifies/templates This PR modifies the template files label May 29, 2024
@techknowlogick
Copy link
Member

Thanks!! 🙏

This is so helpful. The visual changes look great!

I think the CI changes may be related, perhaps due to an undefined variable previously wrapped in a guard conditional.

My main development machine is undergoing some repairs, and so I can't properly go through this changeset for review right now, but if you'd like for me to determine the cause of the CI fail I can do that for you once I'm back on my main device.

@BlenderDefender
Copy link
Contributor Author

@techknowlogick That would be really helpful. Do you know who I can ask to review this PR?

@silverwind
Copy link
Member

silverwind commented May 30, 2024

Looks nice based on the screenshots. I had started only on the commit detail page in #30221, but this looks more complete. Maybe you can take some inspiration from my PR.

You will definitely want to include the removal of unused CSS here.

@BlenderDefender
Copy link
Contributor Author

@silverwind Looks like there are quite a few styles that will be removed with this... The isSigned class isn't used anymore, so all styles with that selector can be removed.
grafik

@silverwind
Copy link
Member

silverwind commented May 30, 2024

@silverwind Looks like there are quite a few styles that will be removed with this... The isSigned class isn't used anymore, so all styles with that selector can be removed.

Indeed, please remove all CSS that has the isSigned class in it. I did similar here but am not sure if my removal there is complete, so remove until a search for isSigned does not match anywhere in the CSS files anymore.

This commit removes all classnames (like for example `ui text`) that don't have any effect on the elements they're applied to.
@silverwind
Copy link
Member

silverwind commented May 30, 2024

One request: Instead of

image

could we use this SVG icon:

image

If you want to show some additional text, it can be done with data-tooltip-content on the element. Again, you can take a hint from my PR, the icon logic is here and we should extract it into a subtemplate.

These styles aren't used anymore, so they can be safely deleted
@BlenderDefender
Copy link
Contributor Author

Would look like this, I'm not quite sure about the warning icon in light mode though:
grafik
grafik
grafik
grafik

@silverwind
Copy link
Member

Hmm, after seeing GitHub also has only text labels in these places, let's keep the text labels. One change I would like to see is normal border radius (tw-rounded), then I think it's fine. Should look similar to this:

image

@pull-request-size pull-request-size bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 30, 2024
@lunny lunny added this to the 1.23.0 milestone May 31, 2024
@BlenderDefender
Copy link
Contributor Author

I'm trying to find the causes of the failing tests, here's what I've found:
tests/integration/git_test.go:628, tries to find a tbody that doesn't exist anymore
tests/integration/pull_status_test.go:48, 86 and 91, same issue as above
tests/integration/repo_commits_search_test.go:25, same issue as above

And the tests in repo_commits_test.go still fail, unfortunately.

@BlenderDefender
Copy link
Contributor Author

I guess this needs to be fixed... It would be great, if the backend processed the commit summary in a way, that the summary has a maximum length, and everything longer than that would be added to the multiline commit message. For now, I'm fixing this by adding max-width and inline-flex to the commit summary:

grafik
grafik

@silverwind
Copy link
Member

I guess this needs to be fixed... It would be great, if the backend processed the commit summary in a way, that the summary has a maximum length, and everything longer than that would be added to the multiline commit message. For now, I'm fixing this by adding max-width and inline-flex to the commit summary:

grafik grafik

We tend to fix such issues in the frontend only, and I guess in the case of commit list we could just make it wrap for now which matches the previous implementation.

  • Commit list wraps
  • Single commit view wraps
  • Files table uses ellipsis
  • Latest commit to file uses ellsipsis

Maybe unify later, backend already has a mechanism for the "..." button for the commit message body.

@silverwind
Copy link
Member

silverwind commented May 31, 2024

For now, I'm fixing this by adding max-width and inline-flex to the

max-width is never the right fix, but I will try if I come up with something better, there are many methods to fix overflow, most involve gt-ellipsis and restricting the parent node width, but in this case we should use wrap anyways.

@silverwind
Copy link
Member

This whole commit message wrapping/ellipsis CSS is a huge mess that needs cleanup, I will see what I can do.

@silverwind
Copy link
Member

Okay I think I fixed all the overflows, here's all 4 variants of commit message now:

Screenshot 2024-06-01 at 00 26 18 Screenshot 2024-06-01 at 00 26 27 Screenshot 2024-06-01 at 00 26 46 Screenshot 2024-06-01 at 00 26 56

@silverwind
Copy link
Member

And I also fixed the commit message expansion on .latest-commit:

Unexpanded:

Screenshot 2024-06-01 at 01 19 15

Expanded:

Screenshot 2024-06-01 at 01 19 24

Not perfect, but acceptable imho, given that we are still have the restricting <table> in the repo files table.

templates/repo/signature_badge.tmpl Outdated Show resolved Hide resolved
Comment on lines +53 to +92
{{if .verification.Verified}}
{{if ne .verification.SigningUser.ID 0}}
{{if .verification.SigningSSHKey}}
<span>{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
{{.verification.SigningSSHKey.Fingerprint}}
{{else}}
<span>{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
{{.verification.SigningKey.PaddedKeyID}}
{{end}}
{{else}}
{{if .verification.SigningSSHKey}}
<span data-tooltip-content="{{ctx.Locale.Tr "gpg.default_key"}}">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
{{.verification.SigningSSHKey.Fingerprint}}
{{else}}
<span data-tooltip-content="{{ctx.Locale.Tr "gpg.default_key"}}">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
{{.verification.SigningKey.PaddedKeyID}}
{{end}}
{{end}}
{{else if .verification.Warning}}
{{if .verification.SigningSSHKey}}
<span>{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
{{.verification.SigningSSHKey.Fingerprint}}
{{else}}
<span>{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
{{.verification.SigningKey.PaddedKeyID}}
{{end}}
{{else}}
{{if .verification.SigningKey}}
{{if ne .verification.SigningKey.KeyID ""}}
<span>{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
{{.verification.SigningKey.PaddedKeyID}}
{{end}}
{{end}}
{{if .verification.SigningSSHKey}}
{{if ne .verification.SigningSSHKey.Fingerprint ""}}
<span>{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
{{.verification.SigningSSHKey.Fingerprint}}
{{end}}
{{end}}
{{end}}
Copy link
Member

Choose a reason for hiding this comment

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

Wait, how do all these spans differ?
To me, it looks like there's a lot of unnecessary duplication here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's honestly a good question, I've pretty much just copied over the code from templates/repo/commit_page.tmpl and adapted the layout to fit into the modal. I'll try to find ways to remove duplication here.

@silverwind
Copy link
Member

silverwind commented Jun 2, 2024

For reference, here are the currently failing tests. Failing very likely because of changed HTML structure.

FAIL: TestGit (132.41s)
FAIL: TestGit/HTTP (58.30s)
FAIL: TestGit/HTTP/AutoMerge (3.54s)
FAIL: TestGit/HTTP/AutoMerge/CreateStatus (0.10s)
FAIL: TestGit/HTTP/AutoMerge/CreateStatus#01 (0.09s)
FAIL: TestGit/HTTP/AutoMerge/CreateStatus#02 (0.09s)
FAIL: TestPullCreate_CommitStatus (3.12s)
FAIL: TestPullCreate_CommitStatus/CreateStatus (0.09s)
FAIL: TestPullCreate_CommitStatus/CreateStatus#01 (0.10s)
FAIL: TestPullCreate_CommitStatus/CreateStatus#02 (0.09s)
FAIL: TestPullCreate_CommitStatus/CreateStatus#03 (0.10s)
FAIL: TestPullCreate_CommitStatus/CreateStatus#04 (0.10s)
FAIL: TestRepoCommitsSearch (1.37s)
FAIL: TestRepoCommitsWithStatusPending (1.04s)
FAIL: TestRepoCommitsWithStatusSuccess (1.05s)
FAIL: TestRepoCommitsWithStatusError (1.02s)
FAIL: TestRepoCommitsWithStatusFailure (1.04s)
FAIL: TestRepoCommitsWithStatusWarning (1.05s)
FAIL: TestRepoCommitsStatusMultiple (1.07s)

@BlenderDefender
Copy link
Contributor Author

@silverwind Regarding the failing tests, would it be an option to add a data-testid attribute to all the elements that the tests are trying to check?

@silverwind
Copy link
Member

silverwind commented Jun 11, 2024

Littering templates with test attributes is not acceptable imho. I still think we can fix them without such hacks, I will check later but feel free to investigate yourself in the meanwhile.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 12, 2024
@delvh
Copy link
Member

delvh commented Jun 20, 2024

@silverwind did you have time to fix these hacks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 1 This PR needs approval from one additional maintainer to be merged. modifies/go Pull requests that update Go code modifies/js modifies/templates This PR modifies the template files modifies/translation size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

De-emphasize signed commits
6 participants