mirror of https://github.com/go-gitea/gitea.git
Add disable gravatar option
parent
3bd5fc6d6f
commit
e7d8fadb08
|
@ -166,6 +166,7 @@ SESSION_ID_HASHKEY =
|
|||
[picture]
|
||||
; The place to picture data, either "server" or "qiniu", default is "server"
|
||||
SERVICE = server
|
||||
DISABLE_GRAVATAR = false
|
||||
|
||||
[log]
|
||||
; Either "console", "file", "conn", "smtp" or "database", default is "console"
|
||||
|
|
|
@ -74,7 +74,9 @@ func (user *User) HomeLink() string {
|
|||
|
||||
// AvatarLink returns the user gravatar link.
|
||||
func (user *User) AvatarLink() string {
|
||||
if base.Service.EnableCacheAvatar {
|
||||
if base.DisableGravatar {
|
||||
return "/img/avatar_default.jpg"
|
||||
} else if base.Service.EnableCacheAvatar {
|
||||
return "/avatar/" + user.Avatar
|
||||
}
|
||||
return "//1.gravatar.com/avatar/" + user.Avatar
|
||||
|
|
|
@ -80,7 +80,8 @@ var (
|
|||
SessionConfig *session.Config
|
||||
SessionManager *session.Manager
|
||||
|
||||
PictureService string
|
||||
PictureService string
|
||||
DisableGravatar bool
|
||||
|
||||
EnableRedis bool
|
||||
EnableMemcache bool
|
||||
|
@ -345,7 +346,9 @@ func NewConfigContext() {
|
|||
LogInRememberDays = Cfg.MustInt("security", "LOGIN_REMEMBER_DAYS")
|
||||
CookieUserName = Cfg.MustValue("security", "COOKIE_USERNAME")
|
||||
CookieRememberName = Cfg.MustValue("security", "COOKIE_REMEMBER_NAME")
|
||||
|
||||
PictureService = Cfg.MustValue("picture", "SERVICE")
|
||||
DisableGravatar = Cfg.MustBool("picture", "DISABLE_GRAVATAR", false)
|
||||
|
||||
// Determine and create root git reposiroty path.
|
||||
homeDir, err := com.HomeDir()
|
||||
|
|
|
@ -169,6 +169,7 @@ func Config(ctx *middleware.Context) {
|
|||
ctx.Data["SessionConfig"] = base.SessionConfig
|
||||
|
||||
ctx.Data["PictureService"] = base.PictureService
|
||||
ctx.Data["DisableGravatar"] = base.DisableGravatar
|
||||
|
||||
ctx.Data["LogMode"] = base.LogMode
|
||||
ctx.Data["LogConfig"] = base.LogConfig
|
||||
|
|
|
@ -181,6 +181,8 @@
|
|||
<dl class="dl-horizontal admin-dl-horizontal">
|
||||
<dt>Picture Service</dt>
|
||||
<dd>{{.PictureService}}</dd>
|
||||
<dt>Disable Gravatar</dt>
|
||||
<dd><i class="fa fa{{if .DisableGravatar}}-check{{end}}-square-o"></i></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue