99 "strings"
1010 "sync"
1111
12- "code.gitea.io/gitea/modules/git"
1312 "code.gitea.io/gitea/modules/json"
1413 "code.gitea.io/gitea/modules/log"
1514 "code.gitea.io/gitea/modules/options"
@@ -89,20 +88,20 @@ func (m *MaterialIconProvider) FolderIcon(ctx reqctx.RequestContext, isOpen bool
8988 return svg .RenderHTML ("material-folder-generic" , 16 , BasicThemeFolderIconName (isOpen ))
9089}
9190
92- func (m * MaterialIconProvider ) FileIcon (ctx reqctx.RequestContext , entry * git. TreeEntry ) template.HTML {
91+ func (m * MaterialIconProvider ) FileIcon (ctx reqctx.RequestContext , file * FileIcon ) template.HTML {
9392 if m .rules == nil {
94- return BasicThemeIcon (entry )
93+ return BasicThemeIcon (file )
9594 }
9695
97- if entry .IsLink () {
98- if te , err := entry .FollowLink (); err == nil && te .IsDir () {
96+ if file . EntryMode .IsLink () {
97+ if te , err := file . Entry .FollowLink (); err == nil && te .IsDir () {
9998 // keep the old "octicon-xxx" class name to make some "theme plugin selector" could still work
10099 return svg .RenderHTML ("material-folder-symlink" , 16 , "octicon-file-directory-symlink" )
101100 }
102101 return svg .RenderHTML ("octicon-file-symlink-file" ) // TODO: find some better icons for them
103102 }
104103
105- name := m .findIconNameByGit (entry )
104+ name := m .findIconNameByGit (file )
106105 if name == "folder" {
107106 // the material icon pack's "folder" icon doesn't look good, so use our built-in one
108107 // keep the old "octicon-xxx" class name to make some "theme plugin selector" could still work
@@ -112,9 +111,9 @@ func (m *MaterialIconProvider) FileIcon(ctx reqctx.RequestContext, entry *git.Tr
112111 // keep the old "octicon-xxx" class name to make some "theme plugin selector" could still work
113112 extraClass := "octicon-file"
114113 switch {
115- case entry .IsDir ():
114+ case file . EntryMode .IsDir ():
116115 extraClass = BasicThemeFolderIconName (false )
117- case entry .IsSubModule ():
116+ case file . EntryMode .IsSubModule ():
118117 extraClass = "octicon-file-submodule"
119118 }
120119 return m .renderFileIconSVG (ctx , name , iconSVG , extraClass )
@@ -163,9 +162,9 @@ func (m *MaterialIconProvider) FindIconName(name string, isDir bool) string {
163162 return "file"
164163}
165164
166- func (m * MaterialIconProvider ) findIconNameByGit (entry * git. TreeEntry ) string {
167- if entry .IsSubModule () {
165+ func (m * MaterialIconProvider ) findIconNameByGit (file * FileIcon ) string {
166+ if file . EntryMode .IsSubModule () {
168167 return "folder-git"
169168 }
170- return m .FindIconName (entry .Name (), entry .IsDir ())
169+ return m .FindIconName (file .Name , file . EntryMode .IsDir ())
171170}
0 commit comments