aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMario Lubenka <mario.lubenka@googlemail.com>2019-06-02 08:40:12 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2019-06-02 14:40:12 +0800
commit8eba27c79257c6bc68cefbdffbb36d3596e6d3ee (patch)
tree3a79fd7a5beb49d212d82bf61df7d8cd9bf1a613 /modules
parent356854fc5f8d7d1a7e4d68c9e00929e9ce8aa867 (diff)
downloadgitea-8eba27c79257c6bc68cefbdffbb36d3596e6d3ee.tar.gz
gitea-8eba27c79257c6bc68cefbdffbb36d3596e6d3ee.zip
Repository avatar fallback configuration (#7087)
* Only show repository avatar in list when one was selected Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adds fallback configuration option for repository avatar Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Implements repository avatar fallback Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adds admin task for deleting generated repository avatars Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Solve linting issues Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Save avatar before updating database * Linting * Update models/repo.go Co-Authored-By: zeripath <art27@cantab.net>
Diffstat (limited to 'modules')
-rw-r--r--modules/setting/setting.go24
1 files changed, 14 insertions, 10 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 9e96105788..ff53e9a375 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -250,16 +250,18 @@ var (
}
// Picture settings
- AvatarUploadPath string
- AvatarMaxWidth int
- AvatarMaxHeight int
- GravatarSource string
- GravatarSourceURL *url.URL
- DisableGravatar bool
- EnableFederatedAvatar bool
- LibravatarService *libravatar.Libravatar
- AvatarMaxFileSize int64
- RepositoryAvatarUploadPath string
+ AvatarUploadPath string
+ AvatarMaxWidth int
+ AvatarMaxHeight int
+ GravatarSource string
+ GravatarSourceURL *url.URL
+ DisableGravatar bool
+ EnableFederatedAvatar bool
+ LibravatarService *libravatar.Libravatar
+ AvatarMaxFileSize int64
+ RepositoryAvatarUploadPath string
+ RepositoryAvatarFallback string
+ RepositoryAvatarFallbackImage string
// Log settings
LogLevel string
@@ -842,6 +844,8 @@ func NewContext() {
if !filepath.IsAbs(RepositoryAvatarUploadPath) {
RepositoryAvatarUploadPath = path.Join(AppWorkPath, RepositoryAvatarUploadPath)
}
+ RepositoryAvatarFallback = sec.Key("REPOSITORY_AVATAR_FALLBACK").MustString("none")
+ RepositoryAvatarFallbackImage = sec.Key("REPOSITORY_AVATAR_FALLBACK_IMAGE").MustString("/img/repo_default.png")
AvatarMaxWidth = sec.Key("AVATAR_MAX_WIDTH").MustInt(4096)
AvatarMaxHeight = sec.Key("AVATAR_MAX_HEIGHT").MustInt(3072)
AvatarMaxFileSize = sec.Key("AVATAR_MAX_FILE_SIZE").MustInt64(1048576)