#1098 Hide gravatar email field if gravatar is disabled (or offline mode)
This commit is contained in:
parent
6f81c05dde
commit
caf7618ea6
4 changed files with 10 additions and 0 deletions
|
@ -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"
|
||||
},
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -46,10 +46,12 @@
|
|||
<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}}" />
|
||||
</div>
|
||||
{{if not DisableGravatar}}
|
||||
<div class="field">
|
||||
<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}}" />
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="field">
|
||||
<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>
|
||||
|
|
|
@ -46,10 +46,12 @@
|
|||
<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}}" />
|
||||
</div>
|
||||
{{if not DisableGravatar}}
|
||||
<div class="field">
|
||||
<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}}" />
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="field">
|
||||
<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>
|
||||
|
|
Loading…
Reference in a new issue