mirror of https://github.com/go-gitea/gitea.git
#1098 Hide gravatar email field if gravatar is disabled (or offline mode)
parent
6f81c05dde
commit
caf7618ea6
|
@ -118,6 +118,9 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
|
||||||
"CdnMode": func() bool {
|
"CdnMode": func() bool {
|
||||||
return setting.ProdMode && !setting.OfflineMode
|
return setting.ProdMode && !setting.OfflineMode
|
||||||
},
|
},
|
||||||
|
"DisableGravatar": func() bool {
|
||||||
|
return setting.DisableGravatar
|
||||||
|
},
|
||||||
"LoadTimes": func(startTime time.Time) string {
|
"LoadTimes": func(startTime time.Time) string {
|
||||||
return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
|
return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
|
||||||
},
|
},
|
||||||
|
|
|
@ -322,6 +322,9 @@ func NewConfigContext() {
|
||||||
GravatarSource = "//1.gravatar.com/avatar/"
|
GravatarSource = "//1.gravatar.com/avatar/"
|
||||||
}
|
}
|
||||||
DisableGravatar = sec.Key("DISABLE_GRAVATAR").MustBool()
|
DisableGravatar = sec.Key("DISABLE_GRAVATAR").MustBool()
|
||||||
|
if OfflineMode {
|
||||||
|
DisableGravatar = true
|
||||||
|
}
|
||||||
|
|
||||||
if err = Cfg.Section("git").MapTo(&Git); err != nil {
|
if err = Cfg.Section("git").MapTo(&Git); err != nil {
|
||||||
log.Fatal(4, "Fail to map Git settings: %v", err)
|
log.Fatal(4, "Fail to map Git settings: %v", err)
|
||||||
|
|
|
@ -46,10 +46,12 @@
|
||||||
<label for="location">{{.i18n.Tr "org.settings.location"}}</label>
|
<label for="location">{{.i18n.Tr "org.settings.location"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Location}}ipt-error{{end}}" id="location" name="location" type="text" value="{{.Org.Location}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_Location}}ipt-error{{end}}" id="location" name="location" type="text" value="{{.Org.Location}}" />
|
||||||
</div>
|
</div>
|
||||||
|
{{if not DisableGravatar}}
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="gravatar-email">Gravatar {{.i18n.Tr "email"}}</label>
|
<label for="gravatar-email">Gravatar {{.i18n.Tr "email"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Avatar}}ipt-error{{end}}" id="gravatar-email" name="avatar" type="text" value="{{.Org.AvatarEmail}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_Avatar}}ipt-error{{end}}" id="gravatar-email" name="avatar" type="text" value="{{.Org.AvatarEmail}}" />
|
||||||
</div>
|
</div>
|
||||||
|
{{end}}
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<span class="form-label"></span>
|
<span class="form-label"></span>
|
||||||
<button class="btn btn-green btn-large btn-radius" id="change-orgname-btn" href="#change-orgname-modal">{{.i18n.Tr "org.settings.update_settings"}}</button>
|
<button class="btn btn-green btn-large btn-radius" id="change-orgname-btn" href="#change-orgname-modal">{{.i18n.Tr "org.settings.update_settings"}}</button>
|
||||||
|
|
|
@ -46,10 +46,12 @@
|
||||||
<label for="location">{{.i18n.Tr "settings.location"}}</label>
|
<label for="location">{{.i18n.Tr "settings.location"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Location}}ipt-error{{end}}" id="location" name="location" type="text" value="{{.SignedUser.Location}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_Location}}ipt-error{{end}}" id="location" name="location" type="text" value="{{.SignedUser.Location}}" />
|
||||||
</div>
|
</div>
|
||||||
|
{{if not DisableGravatar}}
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="req" for="gravatar-email">Gravatar {{.i18n.Tr "email"}}</label>
|
<label class="req" for="gravatar-email">Gravatar {{.i18n.Tr "email"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Avatar}}ipt-error{{end}}" id="gravatar-email" name="avatar" type="text" value="{{.SignedUser.AvatarEmail}}" />
|
<input class="ipt ipt-large ipt-radius {{if .Err_Avatar}}ipt-error{{end}}" id="gravatar-email" name="avatar" type="text" value="{{.SignedUser.AvatarEmail}}" />
|
||||||
</div>
|
</div>
|
||||||
|
{{end}}
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label></label>
|
<label></label>
|
||||||
<button class="btn btn-green btn-large btn-radius" id="change-username-btn" href="#change-username-modal">{{.i18n.Tr "settings.update_profile"}}</button>
|
<button class="btn btn-green btn-large btn-radius" id="change-username-btn" href="#change-username-modal">{{.i18n.Tr "settings.update_profile"}}</button>
|
||||||
|
|
Loading…
Reference in New Issue