diff --git a/modules/base/template.go b/modules/base/template.go index 196b93510..1442bf0e8 100644 --- a/modules/base/template.go +++ b/modules/base/template.go @@ -118,6 +118,9 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{ "CdnMode": func() bool { return setting.ProdMode && !setting.OfflineMode }, + "DisableGravatar": func() bool { + return setting.DisableGravatar + }, "LoadTimes": func(startTime time.Time) string { return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms" }, diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 462e83845..12fd52c99 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -322,6 +322,9 @@ func NewConfigContext() { GravatarSource = "//1.gravatar.com/avatar/" } DisableGravatar = sec.Key("DISABLE_GRAVATAR").MustBool() + if OfflineMode { + DisableGravatar = true + } if err = Cfg.Section("git").MapTo(&Git); err != nil { log.Fatal(4, "Fail to map Git settings: %v", err) diff --git a/templates/org/settings/options.tmpl b/templates/org/settings/options.tmpl index 1179ede62..86e52fcd8 100644 --- a/templates/org/settings/options.tmpl +++ b/templates/org/settings/options.tmpl @@ -46,10 +46,12 @@ + {{if not DisableGravatar}}