]> source.dussan.org Git - gitea.git/commitdiff
Fix 653
authorUnknwon <joe2010xtmf@163.com>
Sat, 22 Nov 2014 15:22:53 +0000 (10:22 -0500)
committerUnknwon <joe2010xtmf@163.com>
Sat, 22 Nov 2014 15:22:53 +0000 (10:22 -0500)
README.md
README_ZH.md
conf/locale/TRANSLATORS [new file with mode: 0644]
conf/locale/locale_en-US.ini
gogs.go
models/user.go
routers/user/setting.go
templates/.VERSION

index f14c4c1baf4245336044899bac35138d57147372..0501d7efba312f9f307af059da3b0b2e04051309 100644 (file)
--- a/README.md
+++ b/README.md
@@ -77,7 +77,9 @@ There are 5 ways to install Gogs:
 
 ## Contributors
 
-The [core team](http://gogs.io/team) of this project. See [contributors page](https://github.com/gogits/gogs/graphs/contributors) for full list of contributors.
+- The [core team](http://gogs.io/team) of this project. 
+- See [contributors page](https://github.com/gogits/gogs/graphs/contributors) for full list of contributors.
+- See [TRANSLATORS](conf/locale/TRANSLATORS) for full list of translators.
 
 ## License
 
index 7adc5dc5667340015aeae3912d0e34339c21dc62..6facfeb802f7f4f066925cfda7bf5168f68d8f04 100644 (file)
@@ -68,7 +68,9 @@ Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自
 
 ## 贡献成员
 
-本项目的 [开发团队](http://gogs.io/team)。您可以通过查看 [贡献者页面](https://github.com/gogits/gogs/graphs/contributors) 获取完整的贡献者列表。
+- 本项目的 [开发团队](http://gogs.io/team)。
+- 您可以通过查看 [贡献者页面](https://github.com/gogits/gogs/graphs/contributors) 获取完整的贡献者列表。
+- 您可以通过查看 [TRANSLATORS](conf/locale/TRANSLATORS) 文件获取完整的翻译人员列表。
 
 ## 授权许可
 
diff --git a/conf/locale/TRANSLATORS b/conf/locale/TRANSLATORS
new file mode 100644 (file)
index 0000000..a07e7d5
--- /dev/null
@@ -0,0 +1,3 @@
+# This file lists all individuals having contributed content to the translation.
+
+Thomas Fanninger <gogs.thomas@fanninger.at>
\ No newline at end of file
index f82e834c2e78db2ed151dba7aae6b18e75402c1d..d798f23eccc93f13b36617b51f313aeda656a0d5 100644 (file)
@@ -208,6 +208,7 @@ enable_custom_avatar_helper = Enable this to disable fetch from Gravatar
 choose_new_avatar = Choose new avatar
 update_avatar = Update Avatar Setting
 uploaded_avatar_not_a_image = Uploaded file is not a image.
+no_custom_avatar_available = No custom avatar available, cannot enable it.
 update_avatar_success = Your avatar setting has been updated successfully.
 
 change_password = Change Password
diff --git a/gogs.go b/gogs.go
index 4027659863b82640cc07e4f0264e0c6f7fd4914c..60e53fb4ed2a6fc4929ee2ddd90ece6252d7b335 100644 (file)
--- a/gogs.go
+++ b/gogs.go
@@ -17,7 +17,7 @@ import (
        "github.com/gogits/gogs/modules/setting"
 )
 
-const APP_VER = "0.5.8.1121 Beta"
+const APP_VER = "0.5.8.1122 Beta"
 
 func init() {
        runtime.GOMAXPROCS(runtime.NumCPU())
index b0cc2ae15639b05d744b57c7fb634354da9c70c9..9eead462e24848e44b9b55629ed3e5661b17520a 100644 (file)
@@ -140,10 +140,14 @@ func (u *User) ValidtePassword(passwd string) bool {
        return u.Passwd == newUser.Passwd
 }
 
+// CustomAvatarPath returns user custom avatar file path.
+func (u *User) CustomAvatarPath() string {
+       return filepath.Join(setting.AvatarUploadPath, com.ToStr(u.Id))
+}
+
 // UploadAvatar saves custom avatar for user.
 // FIXME: splite uploads to different subdirs in case we have massive users.
 func (u *User) UploadAvatar(data []byte) error {
-       savePath := filepath.Join(setting.AvatarUploadPath, com.ToStr(u.Id))
        u.UseCustomAvatar = true
 
        img, _, err := image.Decode(bytes.NewReader(data))
@@ -164,7 +168,7 @@ func (u *User) UploadAvatar(data []byte) error {
        }
 
        os.MkdirAll(setting.AvatarUploadPath, os.ModePerm)
-       fw, err := os.Create(savePath)
+       fw, err := os.Create(u.CustomAvatarPath())
        if err != nil {
                sess.Rollback()
                return err
index 7aeb349727e6aa67733071aa09c803418cb0d9c4..304ddd362b71d37cf9d22726b5cdb2840972c72b 100644 (file)
@@ -89,9 +89,6 @@ func SettingsAvatar(ctx *middleware.Context, form auth.UploadAvatarForm) {
        defer ctx.Redirect(setting.AppSubUrl + "/user/settings")
 
        ctx.User.UseCustomAvatar = form.Enable
-       if err := models.UpdateUser(ctx.User); err != nil {
-               ctx.Flash.Error(err.Error())
-       }
 
        if form.Avatar != nil {
                fr, err := form.Avatar.Open()
@@ -113,7 +110,19 @@ func SettingsAvatar(ctx *middleware.Context, form auth.UploadAvatarForm) {
                        ctx.Flash.Error(err.Error())
                        return
                }
+       } else {
+               // In case no avatar at all.
+               if form.Enable && !com.IsFile(ctx.User.CustomAvatarPath()) {
+                       ctx.Flash.Error(ctx.Tr("settings.no_custom_avatar_available"))
+                       return
+               }
        }
+
+       if err := models.UpdateUser(ctx.User); err != nil {
+               ctx.Flash.Error(err.Error())
+               return
+       }
+
        ctx.Flash.Success(ctx.Tr("settings.update_avatar_success"))
 }
 
index 5de719a000227449311abd10284bbe05fca579cd..d2d39a12682768e3a1afb332edaadcaaa0ec0792 100644 (file)
@@ -1 +1 @@
-0.5.8.1121 Beta
\ No newline at end of file
+0.5.8.1122 Beta
\ No newline at end of file