gitea icon indicating copy to clipboard operation
gitea copied to clipboard

De-emphasize signed commits

Open BlenderDefender opened this issue 1 year ago • 8 comments
trafficstars

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

BlenderDefender avatar May 29 '24 12:05 BlenderDefender

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.

techknowlogick avatar May 29 '24 23:05 techknowlogick

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

BlenderDefender avatar May 30 '24 07:05 BlenderDefender

Looks nice based on the screenshots. I had started only on the commit detail page in https://github.com/go-gitea/gitea/pull/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.

silverwind avatar May 30 '24 16:05 silverwind

@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

BlenderDefender avatar May 30 '24 19:05 BlenderDefender

@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.

silverwind avatar May 30 '24 20:05 silverwind

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.

silverwind avatar May 30 '24 20:05 silverwind

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

BlenderDefender avatar May 30 '24 20:05 BlenderDefender

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

silverwind avatar May 30 '24 20:05 silverwind

Issue on commit graph: Unsigned commits have no spacing:

image

As I already mention, I strongly recommend to use tw-gap-2 on the flex parent, and then remove all horizontal margin classes tw-m* on all children. Please do that for all similar cases touched in this PR.

silverwind avatar May 31 '24 11:05 silverwind

I pushed a change that introduces a commit-hash-link class used for plain hash links.

Commit graph:

image

Commit page: image

silverwind avatar May 31 '24 11:05 silverwind

Will do the other suggested changes and fix the remaining hash links.

silverwind avatar May 31 '24 11:05 silverwind

Done with my changes, you can do the other suggestions :)

silverwind avatar May 31 '24 11:05 silverwind

Oh and one more thing: I assume there is more unused CSS, if you can identify more, please remove.

silverwind avatar May 31 '24 11:05 silverwind

will do 👍

BlenderDefender avatar May 31 '24 11:05 BlenderDefender

I pushed some hopefully working fixes for the failing integration tests.

silverwind avatar May 31 '24 13:05 silverwind

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 avatar May 31 '24 19:05 BlenderDefender

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

BlenderDefender avatar May 31 '24 19:05 BlenderDefender

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 avatar May 31 '24 21:05 silverwind

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 avatar May 31 '24 21:05 silverwind

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

silverwind avatar May 31 '24 22:05 silverwind

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 avatar May 31 '24 22:05 silverwind

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.

silverwind avatar May 31 '24 23:05 silverwind

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)

silverwind avatar Jun 02 '24 17:06 silverwind

@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?

BlenderDefender avatar Jun 09 '24 09:06 BlenderDefender

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.

silverwind avatar Jun 11 '24 11:06 silverwind

@silverwind did you have time to fix these hacks?

delvh avatar Jun 20 '24 20:06 delvh

I still think we can fix them without such hacks, I will check later but feel free to investigate yourself in the meanwhile.

@silverwind @BlenderDefender how to continue?

wxiaoguang avatar Dec 23 '24 14:12 wxiaoguang

Manged to fix some problems. And FYI: the modal can't be used, the reason is complicated but since this PR is stale for long time, I won't spend time on explaining it unless there are interests.

wxiaoguang avatar Dec 27 '24 18:12 wxiaoguang

Since this PR now also blocks others, so I merge it after CI passes. If there is anything wrong, I will also fix in first time.

And there could be more fine-tunes to the colors to de-emphasize more

wxiaoguang avatar Dec 27 '24 20:12 wxiaoguang