mirror of
1
Fork 0

[v10.0/forgejo] fix(ui): display verified icon for default gpg key (#6833)

**Backport:** https://codeberg.org/forgejo/forgejo/pulls/6803

## Description
Thank you for this amazing project!

I recently noticed that the icon next to the GPG key reference appears to be incorrect for commits signed by the default GPG key:

| Default GPG Key  | User GPG Key  |
|---------|---------|
| ![image](/attachments/ff27597a-d38c-48fc-8284-e16d4fd3ea2d) | ![image](/attachments/3c8c5540-dd29-45c9-a9f0-dc3b69677ef3) |

Looking into the commit history of the template file, I noticed that Forgejo-signed commits originally had a distinct icon:
[gitea-unlock-cog](b918609acc) --> [octicon-shield-lock](12ddc48c5c) --> octicon-unverified (current)

Since `octicon-unverified` is also used when a commit cannot be verified (.Verification.Warning), I find it misleading for successfully signed commits. This PR changes the icon to the verified variant for better clarity.

### Tests

1. Set up automatic commit signing by Forgejo ([guide](https://forgejo.org/docs/latest/admin/signing/#automatic-signing))
2. Trigger automatic commit signing in any of the following scenarios:
    - Repository Initialisation (should be the easiest)
    - Wiki Changes
    - CRUD actions using the editor or the API
    - Merges from Pull Requests
3. Open the commit signed by Forgejo
4. Verify that the icon next to the GPG key id is `octicon-verified`:
![image](/attachments/7b4eb81c-d33c-4daf-84dd-9f99ebb0b99d)

### Documentation

- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [x] I want the title to show in the release notes with a link to this pull request.

<!--start release-notes-assistant-->

## Release notes
<!--URL:https://codeberg.org/forgejo/forgejo-->
- User Interface bug fixes
  - [PR](https://codeberg.org/forgejo/forgejo/pulls/6803): <!--number 6803 --><!--line 0 --><!--description Zml4KHVpKTogZGlzcGxheSB2ZXJpZmllZCBpY29uIGZvciBkZWZhdWx0IGdwZyBrZXk=-->fix(ui): display verified icon for default gpg key<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: shgew <shgew@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6833
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Beowulf <beowulf@beocode.eu>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
forgejo-backport-action 2025-02-07 13:16:23 +00:00 committed by Otto
parent d260013a51
commit 34d2a8531c
1 changed files with 1 additions and 2 deletions

View File

@ -217,8 +217,8 @@
</div> </div>
<div class="tw-flex tw-items-center"> <div class="tw-flex tw-items-center">
{{if .Verification.Verified}} {{if .Verification.Verified}}
{{svg "octicon-verified" 16 "tw-mr-2"}}
{{if ne .Verification.SigningUser.ID 0}} {{if ne .Verification.SigningUser.ID 0}}
{{svg "octicon-verified" 16 "tw-mr-2"}}
{{if .Verification.SigningSSHKey}} {{if .Verification.SigningSSHKey}}
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span> <span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
{{.Verification.SigningSSHKey.Fingerprint}} {{.Verification.SigningSSHKey.Fingerprint}}
@ -227,7 +227,6 @@
{{.Verification.SigningKey.PaddedKeyID}} {{.Verification.SigningKey.PaddedKeyID}}
{{end}} {{end}}
{{else}} {{else}}
{{svg "octicon-unverified" 16 "tw-mr-2"}}
{{if .Verification.SigningSSHKey}} {{if .Verification.SigningSSHKey}}
<span class="ui text tw-mr-2" data-tooltip-content="{{ctx.Locale.Tr "gpg.default_key"}}">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span> <span class="ui text tw-mr-2" data-tooltip-content="{{ctx.Locale.Tr "gpg.default_key"}}">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
{{.Verification.SigningSSHKey.Fingerprint}} {{.Verification.SigningSSHKey.Fingerprint}}