mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-21 16:40:52 +00:00
Show if commit is signed in activity feed and unify sha box (#6933)
Some checks are pending
/ release (push) Waiting to run
testing / backend-checks (push) Has been skipped
testing / frontend-checks (push) Has been skipped
testing / test-unit (push) Has been skipped
testing / test-e2e (push) Has been skipped
testing / test-mysql (push) Has been skipped
testing / test-pgsql (push) Has been skipped
testing / test-sqlite (push) Has been skipped
testing / test-remote-cacher (redis) (push) Has been skipped
testing / test-remote-cacher (valkey) (push) Has been skipped
testing / test-remote-cacher (garnet) (push) Has been skipped
testing / test-remote-cacher (redict) (push) Has been skipped
testing / security-check (push) Has been skipped
Some checks are pending
/ release (push) Waiting to run
testing / backend-checks (push) Has been skipped
testing / frontend-checks (push) Has been skipped
testing / test-unit (push) Has been skipped
testing / test-e2e (push) Has been skipped
testing / test-mysql (push) Has been skipped
testing / test-pgsql (push) Has been skipped
testing / test-sqlite (push) Has been skipped
testing / test-remote-cacher (redis) (push) Has been skipped
testing / test-remote-cacher (valkey) (push) Has been skipped
testing / test-remote-cacher (garnet) (push) Has been skipped
testing / test-remote-cacher (redict) (push) Has been skipped
testing / security-check (push) Has been skipped
Old activities are shown like before, new commits are displayed like commits in e.g. the commits list. _(Second commit)_ | New signed commits | Old (signed) commits | |:--:|:--:| |  |  | Additionally the sha box was moved in an own component to unify the usage. _(First commit)_ Closes #1824 <!--start release-notes-assistant--> ## Release notes <!--URL:https://codeberg.org/forgejo/forgejo--> - User Interface features - [PR](https://codeberg.org/forgejo/forgejo/pulls/6933): <!--number 6933 --><!--line 0 --><!--description U2hvdyBpZiBjb21taXQgaXMgdmVyaWZpZWQgaW4gYWN0aXZpdHkgZmVlZCBvZiBhbiB1c2VyIG9yIGFuIG9yZ2FuaXphdGlvbiBmb3IgbmV3IGFjdGl2aXR5-->Show if commit is verified in activity feed of an user or an organization for new activity<!--description--> <!--end release-notes-assistant--> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6933 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Beowulf <beowulf@beocode.eu> Co-committed-by: Beowulf <beowulf@beocode.eu>
This commit is contained in:
parent
82477cb55c
commit
37d566bdb0
22 changed files with 344 additions and 89 deletions
|
@ -1,4 +1,5 @@
|
|||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Copyright 2025 The Forgejo Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package repository
|
||||
|
@ -9,6 +10,7 @@ import (
|
|||
"net/url"
|
||||
"time"
|
||||
|
||||
asymkey_model "forgejo.org/models/asymkey"
|
||||
"forgejo.org/models/avatars"
|
||||
user_model "forgejo.org/models/user"
|
||||
"forgejo.org/modules/cache"
|
||||
|
@ -26,6 +28,8 @@ type PushCommit struct {
|
|||
AuthorName string
|
||||
CommitterEmail string
|
||||
CommitterName string
|
||||
Signature *git.ObjectSignature
|
||||
Verification *asymkey_model.ObjectVerification
|
||||
Timestamp time.Time
|
||||
}
|
||||
|
||||
|
@ -145,6 +149,32 @@ func (pc *PushCommits) AvatarLink(ctx context.Context, email string) string {
|
|||
return v
|
||||
}
|
||||
|
||||
// PushCommitToCommit transforms a PushCommit to a git.Commit type on a best effort basis.
|
||||
//
|
||||
// Attention: Converting a Commit to a PushCommit and converting back to a Commit will not result in an identical object!
|
||||
func PushCommitToCommit(commit *PushCommit) (*git.Commit, error) {
|
||||
id, err := git.NewIDFromString(commit.Sha1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &git.Commit{
|
||||
ID: id,
|
||||
Author: &git.Signature{
|
||||
Name: commit.AuthorName,
|
||||
Email: commit.AuthorEmail,
|
||||
When: commit.Timestamp,
|
||||
},
|
||||
Committer: &git.Signature{
|
||||
Name: commit.CommitterName,
|
||||
Email: commit.CommitterEmail,
|
||||
When: commit.Timestamp,
|
||||
},
|
||||
CommitMessage: commit.Message,
|
||||
Signature: commit.Signature,
|
||||
Parents: []git.ObjectID{},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// CommitToPushCommit transforms a git.Commit to PushCommit type.
|
||||
func CommitToPushCommit(commit *git.Commit) *PushCommit {
|
||||
return &PushCommit{
|
||||
|
@ -154,6 +184,7 @@ func CommitToPushCommit(commit *git.Commit) *PushCommit {
|
|||
AuthorName: commit.Author.Name,
|
||||
CommitterEmail: commit.Committer.Email,
|
||||
CommitterName: commit.Committer.Name,
|
||||
Signature: commit.Signature,
|
||||
Timestamp: commit.Author.When,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue