Audit of 3560327
This commit is contained in:
@@ -3,7 +3,6 @@ package agents
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -16,7 +15,7 @@ const signTimeout = 2 * time.Minute
|
||||
func (m *Manager) signer(ctx context.Context, user api.User) func(payload []byte) ([]byte, error) {
|
||||
return func(payload []byte) ([]byte, error) {
|
||||
mine := []clients.Client{}
|
||||
for _, c := range m.clients.List() {
|
||||
for _, c := range m.recentClients() {
|
||||
if c.Login == user.Login {
|
||||
mine = append(mine, c)
|
||||
}
|
||||
@@ -24,10 +23,7 @@ func (m *Manager) signer(ctx context.Context, user api.User) func(payload []byte
|
||||
if len(mine) == 0 {
|
||||
return nil, fmt.Errorf("commits are signed on %s's Mac, and none of theirs is connected", user.Login)
|
||||
}
|
||||
sort.SliceStable(mine, func(i, j int) bool {
|
||||
a, b := mine[i].LastActionAt, mine[j].LastActionAt
|
||||
return a != nil && (b == nil || a.After(*b))
|
||||
})
|
||||
|
||||
client := mine[0]
|
||||
|
||||
ident := fmt.Sprintf("%s <%s>", user.GitName, user.GitEmail)
|
||||
|
||||
Reference in New Issue
Block a user