Skip to content

Commit 8f4dd55

Browse files
zeripathmrsdizzie
authored andcommitted
Make ComposeMetas always return a valid context
1 parent bb5338d commit 8f4dd55

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

models/repo.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -469,19 +469,19 @@ func (repo *Repository) mustOwnerName(e Engine) string {
469469
return repo.OwnerName
470470
}
471471

472-
// ComposeMetas composes a map of metas for rendering external issue tracker URL.
472+
// ComposeMetas composes a map of metas for properly rendering issue links and external issue trackers.
473473
func (repo *Repository) ComposeMetas() map[string]string {
474-
unit, err := repo.GetUnit(UnitTypeExternalTracker)
475-
if err != nil {
476-
return nil
477-
}
478-
479474
if repo.ExternalMetas == nil {
480475
repo.ExternalMetas = map[string]string{
481-
"format": unit.ExternalTrackerConfig().ExternalTrackerFormat,
482-
"user": repo.MustOwner().Name,
483-
"repo": repo.Name,
476+
"user": repo.MustOwner().Name,
477+
"repo": repo.Name,
484478
}
479+
unit, err := repo.GetUnit(UnitTypeExternalTracker)
480+
if err != nil {
481+
return repo.ExternalMetas
482+
}
483+
484+
repo.ExternalMetas["format"] = unit.ExternalTrackerConfig().ExternalTrackerFormat
485485
switch unit.ExternalTrackerConfig().ExternalTrackerStyle {
486486
case markup.IssueNameStyleAlphanumeric:
487487
repo.ExternalMetas["style"] = markup.IssueNameStyleAlphanumeric

0 commit comments

Comments
 (0)