mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
chore: upgrade tailscale to v1.46.1 (#8913)
This commit is contained in:
@ -605,8 +605,8 @@ func uniqueSortedUUIDs(uuids []uuid.UUID) []uuid.UUID {
|
||||
for id := range set {
|
||||
unique = append(unique, id)
|
||||
}
|
||||
slices.SortFunc(unique, func(a, b uuid.UUID) bool {
|
||||
return a.String() < b.String()
|
||||
slices.SortFunc(unique, func(a, b uuid.UUID) int {
|
||||
return slice.Ascending(a.String(), b.String())
|
||||
})
|
||||
return unique
|
||||
}
|
||||
@ -2060,8 +2060,8 @@ func (q *FakeQuerier) GetTemplateDailyInsights(_ context.Context, arg database.G
|
||||
for templateID := range ds.templateIDSet {
|
||||
templateIDs = append(templateIDs, templateID)
|
||||
}
|
||||
slices.SortFunc(templateIDs, func(a, b uuid.UUID) bool {
|
||||
return a.String() < b.String()
|
||||
slices.SortFunc(templateIDs, func(a, b uuid.UUID) int {
|
||||
return slice.Ascending(a.String(), b.String())
|
||||
})
|
||||
result = append(result, database.GetTemplateDailyInsightsRow{
|
||||
StartTime: ds.startTime,
|
||||
@ -2119,8 +2119,8 @@ func (q *FakeQuerier) GetTemplateInsights(_ context.Context, arg database.GetTem
|
||||
for templateID := range templateIDSet {
|
||||
templateIDs = append(templateIDs, templateID)
|
||||
}
|
||||
slices.SortFunc(templateIDs, func(a, b uuid.UUID) bool {
|
||||
return a.String() < b.String()
|
||||
slices.SortFunc(templateIDs, func(a, b uuid.UUID) int {
|
||||
return slice.Ascending(a.String(), b.String())
|
||||
})
|
||||
result := database.GetTemplateInsightsRow{
|
||||
TemplateIDs: templateIDs,
|
||||
@ -2343,13 +2343,16 @@ func (q *FakeQuerier) GetTemplateVersionsByTemplateID(_ context.Context, arg dat
|
||||
}
|
||||
|
||||
// Database orders by created_at
|
||||
slices.SortFunc(version, func(a, b database.TemplateVersion) bool {
|
||||
slices.SortFunc(version, func(a, b database.TemplateVersion) int {
|
||||
if a.CreatedAt.Equal(b.CreatedAt) {
|
||||
// Technically the postgres database also orders by uuid. So match
|
||||
// that behavior
|
||||
return a.ID.String() < b.ID.String()
|
||||
return slice.Ascending(a.ID.String(), b.ID.String())
|
||||
}
|
||||
return a.CreatedAt.Before(b.CreatedAt)
|
||||
if a.CreatedAt.Before(b.CreatedAt) {
|
||||
return -1
|
||||
}
|
||||
return 1
|
||||
})
|
||||
|
||||
if arg.AfterID != uuid.Nil {
|
||||
@ -2408,11 +2411,11 @@ func (q *FakeQuerier) GetTemplates(_ context.Context) ([]database.Template, erro
|
||||
defer q.mutex.RUnlock()
|
||||
|
||||
templates := slices.Clone(q.templates)
|
||||
slices.SortFunc(templates, func(i, j database.TemplateTable) bool {
|
||||
if i.Name != j.Name {
|
||||
return i.Name < j.Name
|
||||
slices.SortFunc(templates, func(a, b database.TemplateTable) int {
|
||||
if a.Name != b.Name {
|
||||
return slice.Ascending(a.Name, b.Name)
|
||||
}
|
||||
return i.ID.String() < j.ID.String()
|
||||
return slice.Ascending(a.ID.String(), b.ID.String())
|
||||
})
|
||||
|
||||
return q.templatesWithUserNoLock(templates), nil
|
||||
@ -2525,8 +2528,8 @@ func (q *FakeQuerier) GetUserLatencyInsights(_ context.Context, arg database.Get
|
||||
for templateID := range templateIDSet {
|
||||
templateIDs = append(templateIDs, templateID)
|
||||
}
|
||||
slices.SortFunc(templateIDs, func(a, b uuid.UUID) bool {
|
||||
return a.String() < b.String()
|
||||
slices.SortFunc(templateIDs, func(a, b uuid.UUID) int {
|
||||
return slice.Ascending(a.String(), b.String())
|
||||
})
|
||||
user, err := q.getUserByIDNoLock(userID)
|
||||
if err != nil {
|
||||
@ -2542,8 +2545,8 @@ func (q *FakeQuerier) GetUserLatencyInsights(_ context.Context, arg database.Get
|
||||
}
|
||||
rows = append(rows, row)
|
||||
}
|
||||
slices.SortFunc(rows, func(a, b database.GetUserLatencyInsightsRow) bool {
|
||||
return a.UserID.String() < b.UserID.String()
|
||||
slices.SortFunc(rows, func(a, b database.GetUserLatencyInsightsRow) int {
|
||||
return slice.Ascending(a.UserID.String(), b.UserID.String())
|
||||
})
|
||||
|
||||
return rows, nil
|
||||
@ -2590,8 +2593,8 @@ func (q *FakeQuerier) GetUsers(_ context.Context, params database.GetUsersParams
|
||||
copy(users, q.users)
|
||||
|
||||
// Database orders by username
|
||||
slices.SortFunc(users, func(a, b database.User) bool {
|
||||
return strings.ToLower(a.Username) < strings.ToLower(b.Username)
|
||||
slices.SortFunc(users, func(a, b database.User) int {
|
||||
return slice.Ascending(strings.ToLower(a.Username), strings.ToLower(b.Username))
|
||||
})
|
||||
|
||||
// Filter out deleted since they should never be returned..
|
||||
@ -2799,14 +2802,14 @@ func (q *FakeQuerier) GetWorkspaceAgentStats(_ context.Context, createdAfter tim
|
||||
|
||||
agentStatsCreatedAfter := make([]database.WorkspaceAgentStat, 0)
|
||||
for _, agentStat := range q.workspaceAgentStats {
|
||||
if agentStat.CreatedAt.After(createdAfter) {
|
||||
if agentStat.CreatedAt.After(createdAfter) || agentStat.CreatedAt.Equal(createdAfter) {
|
||||
agentStatsCreatedAfter = append(agentStatsCreatedAfter, agentStat)
|
||||
}
|
||||
}
|
||||
|
||||
latestAgentStats := map[uuid.UUID]database.WorkspaceAgentStat{}
|
||||
for _, agentStat := range q.workspaceAgentStats {
|
||||
if agentStat.CreatedAt.After(createdAfter) {
|
||||
if agentStat.CreatedAt.After(createdAfter) || agentStat.CreatedAt.Equal(createdAfter) {
|
||||
latestAgentStats[agentStat.AgentID] = agentStat
|
||||
}
|
||||
}
|
||||
@ -3132,9 +3135,8 @@ func (q *FakeQuerier) GetWorkspaceBuildsByWorkspaceID(_ context.Context,
|
||||
}
|
||||
|
||||
// Order by build_number
|
||||
slices.SortFunc(history, func(a, b database.WorkspaceBuild) bool {
|
||||
// use greater than since we want descending order
|
||||
return a.BuildNumber > b.BuildNumber
|
||||
slices.SortFunc(history, func(a, b database.WorkspaceBuild) int {
|
||||
return slice.Descending(a.BuildNumber, b.BuildNumber)
|
||||
})
|
||||
|
||||
if params.AfterID != uuid.Nil {
|
||||
@ -3533,8 +3535,14 @@ func (q *FakeQuerier) InsertAuditLog(_ context.Context, arg database.InsertAudit
|
||||
alog := database.AuditLog(arg)
|
||||
|
||||
q.auditLogs = append(q.auditLogs, alog)
|
||||
slices.SortFunc(q.auditLogs, func(a, b database.AuditLog) bool {
|
||||
return a.Time.Before(b.Time)
|
||||
slices.SortFunc(q.auditLogs, func(a, b database.AuditLog) int {
|
||||
if a.Time.Before(b.Time) {
|
||||
return -1
|
||||
} else if a.Time.Equal(b.Time) {
|
||||
return 0
|
||||
} else {
|
||||
return 1
|
||||
}
|
||||
})
|
||||
|
||||
return alog, nil
|
||||
@ -5588,11 +5596,11 @@ func (q *FakeQuerier) GetAuthorizedTemplates(ctx context.Context, arg database.G
|
||||
templates = append(templates, template)
|
||||
}
|
||||
if len(templates) > 0 {
|
||||
slices.SortFunc(templates, func(i, j database.Template) bool {
|
||||
if i.Name != j.Name {
|
||||
return i.Name < j.Name
|
||||
slices.SortFunc(templates, func(a, b database.Template) int {
|
||||
if a.Name != b.Name {
|
||||
return slice.Ascending(a.Name, b.Name)
|
||||
}
|
||||
return i.ID.String() < j.ID.String()
|
||||
return slice.Ascending(a.ID.String(), b.ID.String())
|
||||
})
|
||||
return templates, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user