mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 11:28:24 +00:00 
			
		
		
		
	Sort repos in issues dashboard sidebar (#3072)
* Sort repos in issues dashboard sidebar * Sort repos by name
This commit is contained in:
		| @@ -16,6 +16,18 @@ import ( | ||||
| // RepositoryList contains a list of repositories | ||||
| type RepositoryList []*Repository | ||||
|  | ||||
| func (repos RepositoryList) Len() int { | ||||
| 	return len(repos) | ||||
| } | ||||
|  | ||||
| func (repos RepositoryList) Less(i, j int) bool { | ||||
| 	return repos[i].FullName() < repos[j].FullName() | ||||
| } | ||||
|  | ||||
| func (repos RepositoryList) Swap(i, j int) { | ||||
| 	repos[i], repos[j] = repos[j], repos[i] | ||||
| } | ||||
|  | ||||
| // RepositoryListOfMap make list from values of map | ||||
| func RepositoryListOfMap(repoMap map[int64]*Repository) RepositoryList { | ||||
| 	return RepositoryList(valuesRepository(repoMap)) | ||||
|   | ||||
| @@ -7,6 +7,7 @@ package user | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"fmt" | ||||
| 	"sort" | ||||
|  | ||||
| 	"github.com/Unknwon/com" | ||||
| 	"github.com/Unknwon/paginater" | ||||
| @@ -302,6 +303,7 @@ func Issues(ctx *context.Context) { | ||||
| 	} | ||||
|  | ||||
| 	showRepos := models.RepositoryListOfMap(showReposMap) | ||||
| 	sort.Sort(showRepos) | ||||
| 	if err = showRepos.LoadAttributes(); err != nil { | ||||
| 		ctx.Handle(500, "LoadAttributes", fmt.Errorf("%v", err)) | ||||
| 		return | ||||
|   | ||||
		Reference in New Issue
	
	Block a user