@@ -173,8 +173,8 @@ type Repository struct {
173173 * Mirror `xorm:"-"`
174174 Status RepositoryStatus `xorm:"NOT NULL DEFAULT 0"`
175175
176- ExternalMetas map [string ]string `xorm:"-"`
177- Units []* RepoUnit `xorm:"-"`
176+ RenderingMetas map [string ]string `xorm:"-"`
177+ Units []* RepoUnit `xorm:"-"`
178178
179179 IsFork bool `xorm:"INDEX NOT NULL DEFAULT false"`
180180 ForkID int64 `xorm:"INDEX"`
@@ -559,27 +559,39 @@ func (repo *Repository) mustOwnerName(e Engine) string {
559559
560560// ComposeMetas composes a map of metas for properly rendering issue links and external issue trackers.
561561func (repo * Repository ) ComposeMetas () map [string ]string {
562- if repo .ExternalMetas == nil {
563- repo . ExternalMetas = map [string ]string {
562+ if repo .RenderingMetas == nil {
563+ metas : = map [string ]string {
564564 "user" : repo .MustOwner ().Name ,
565565 "repo" : repo .Name ,
566566 "repoPath" : repo .RepoPath (),
567567 }
568+
568569 unit , err := repo .GetUnit (UnitTypeExternalTracker )
569- if err != nil {
570- return repo .ExternalMetas
570+ if err == nil {
571+ metas ["format" ] = unit .ExternalTrackerConfig ().ExternalTrackerFormat
572+ switch unit .ExternalTrackerConfig ().ExternalTrackerStyle {
573+ case markup .IssueNameStyleAlphanumeric :
574+ metas ["style" ] = markup .IssueNameStyleAlphanumeric
575+ default :
576+ metas ["style" ] = markup .IssueNameStyleNumeric
577+ }
571578 }
572579
573- repo .ExternalMetas ["format" ] = unit .ExternalTrackerConfig ().ExternalTrackerFormat
574- switch unit .ExternalTrackerConfig ().ExternalTrackerStyle {
575- case markup .IssueNameStyleAlphanumeric :
576- repo .ExternalMetas ["style" ] = markup .IssueNameStyleAlphanumeric
577- default :
578- repo .ExternalMetas ["style" ] = markup .IssueNameStyleNumeric
580+ if repo .Owner .IsOrganization () {
581+ teams := make ([]string , 0 , 5 )
582+ _ = x .Table ("team_repo" ).
583+ Join ("INNER" , "team" , "team.id = team_repo.team_id" ).
584+ Where ("team_repo.repo_id = ?" , repo .ID ).
585+ Select ("team.lower_name" ).
586+ OrderBy ("team.lower_name" ).
587+ Find (& teams )
588+ metas ["teams" ] = "," + strings .Join (teams , "," ) + ","
589+ metas ["org" ] = repo .Owner .LowerName
579590 }
580591
592+ repo .RenderingMetas = metas
581593 }
582- return repo .ExternalMetas
594+ return repo .RenderingMetas
583595}
584596
585597// DeleteWiki removes the actual and local copy of repository wiki.
0 commit comments