mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 13:28:25 +00:00 
			
		
		
		
	Less naked returns (#25713)
just a step towards #25655 and some related refactoring
This commit is contained in:
		@@ -455,9 +455,9 @@ func hashAndVerifyForKeyID(sig *packet.Signature, payload string, committer *use
 | 
			
		||||
 | 
			
		||||
// CalculateTrustStatus will calculate the TrustStatus for a commit verification within a repository
 | 
			
		||||
// There are several trust models in Gitea
 | 
			
		||||
func CalculateTrustStatus(verification *CommitVerification, repoTrustModel repo_model.TrustModelType, isOwnerMemberCollaborator func(*user_model.User) (bool, error), keyMap *map[string]bool) (err error) {
 | 
			
		||||
func CalculateTrustStatus(verification *CommitVerification, repoTrustModel repo_model.TrustModelType, isOwnerMemberCollaborator func(*user_model.User) (bool, error), keyMap *map[string]bool) error {
 | 
			
		||||
	if !verification.Verified {
 | 
			
		||||
		return
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// In the Committer trust model a signature is trusted if it matches the committer
 | 
			
		||||
@@ -475,7 +475,7 @@ func CalculateTrustStatus(verification *CommitVerification, repoTrustModel repo_
 | 
			
		||||
				verification.SigningUser.Email == verification.CommittingUser.Email) {
 | 
			
		||||
			verification.TrustStatus = "trusted"
 | 
			
		||||
		}
 | 
			
		||||
		return
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Now we drop to the more nuanced trust models...
 | 
			
		||||
@@ -490,10 +490,11 @@ func CalculateTrustStatus(verification *CommitVerification, repoTrustModel repo_
 | 
			
		||||
			verification.SigningUser.Email != verification.CommittingUser.Email) {
 | 
			
		||||
			verification.TrustStatus = "untrusted"
 | 
			
		||||
		}
 | 
			
		||||
		return
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Check we actually have a GPG SigningKey
 | 
			
		||||
	var err error
 | 
			
		||||
	if verification.SigningKey != nil {
 | 
			
		||||
		var isMember bool
 | 
			
		||||
		if keyMap != nil {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user