mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 02:46:04 +01:00 
			
		
		
		
	Use project.IconName instead of repeated unreadable if-else chains (#23538)
				
					
				
			The project type will be changed in https://github.com/go-gitea/gitea/pull/23353, so the old fix https://github.com/go-gitea/gitea/pull/23325 will not work as well. And I also found that there were some problems in the old fix.... --------- Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
		| @@ -144,10 +144,21 @@ func (p *Project) Link() string { | ||||
| 	return "" | ||||
| } | ||||
|  | ||||
| func (p *Project) IconName() string { | ||||
| 	if p.IsRepositoryProject() { | ||||
| 		return "octicon-project" | ||||
| 	} | ||||
| 	return "octicon-project-symlink" | ||||
| } | ||||
|  | ||||
| func (p *Project) IsOrganizationProject() bool { | ||||
| 	return p.Type == TypeOrganization | ||||
| } | ||||
|  | ||||
| func (p *Project) IsRepositoryProject() bool { | ||||
| 	return p.Type == TypeRepository | ||||
| } | ||||
|  | ||||
| func init() { | ||||
| 	db.RegisterModel(new(Project)) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user