@@ -173,8 +173,8 @@ type Repository struct {
173
173
* Mirror `xorm:"-"`
174
174
Status RepositoryStatus `xorm:"NOT NULL DEFAULT 0"`
175
175
176
- ExternalMetas map [string ]string `xorm:"-"`
177
- Units []* RepoUnit `xorm:"-"`
176
+ RenderingMetas map [string ]string `xorm:"-"`
177
+ Units []* RepoUnit `xorm:"-"`
178
178
179
179
IsFork bool `xorm:"INDEX NOT NULL DEFAULT false"`
180
180
ForkID int64 `xorm:"INDEX"`
@@ -559,27 +559,39 @@ func (repo *Repository) mustOwnerName(e Engine) string {
559
559
560
560
// ComposeMetas composes a map of metas for properly rendering issue links and external issue trackers.
561
561
func (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 {
564
564
"user" : repo .MustOwner ().Name ,
565
565
"repo" : repo .Name ,
566
566
"repoPath" : repo .RepoPath (),
567
567
}
568
+
568
569
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
+ }
571
578
}
572
579
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
579
590
}
580
591
592
+ repo .RenderingMetas = metas
581
593
}
582
- return repo .ExternalMetas
594
+ return repo .RenderingMetas
583
595
}
584
596
585
597
// DeleteWiki removes the actual and local copy of repository wiki.
0 commit comments