mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-10-31 06:21:11 +00:00 
			
		
		
		
	Part of #25042 1. Added actor and status dropdowns first in case something is offtrack and PR is too large. 2. Also added "No results matched." and "The workflow has no runs yet.", and "No results matched." will show if there is no filter results and there is no workflows (with [reference to github action](https://github.com/go-gitea/gitea/actions/workflows/files-changed.yml?query=actor%3AGiteaBot)) Demo: https://github.com/go-gitea/gitea/assets/17645053/6e76292c-4c1f-450d-8b48-99944cfc920c TODOs: - [x] Get available status (same as those in `aggregateJobStatus`) instead of getting from database - [x] Use `JOIN` to get actors, actors order by name - [x] Make self on top
		
			
				
	
	
		
			23 lines
		
	
	
	
		
			517 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
	
		
			517 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright 2023 The Gitea Authors. All rights reserved.
 | |
| // SPDX-License-Identifier: MIT
 | |
| 
 | |
| package repo
 | |
| 
 | |
| import (
 | |
| 	"sort"
 | |
| 
 | |
| 	"code.gitea.io/gitea/models/user"
 | |
| 	"code.gitea.io/gitea/modules/context"
 | |
| )
 | |
| 
 | |
| func MakeSelfOnTop(ctx *context.Context, users []*user.User) []*user.User {
 | |
| 	if ctx.Doer != nil {
 | |
| 		sort.Slice(users, func(i, j int) bool {
 | |
| 			if users[i].ID == users[j].ID {
 | |
| 				return false
 | |
| 			}
 | |
| 			return users[i].ID == ctx.Doer.ID // if users[i] is self, put it before others, so less=true
 | |
| 		})
 | |
| 	}
 | |
| 	return users
 | |
| }
 |