## 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
## 贡献成员
-本项目的 [开发团队](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) 文件获取完整的翻译人员列表。
## 授权许可
--- /dev/null
+# This file lists all individuals having contributed content to the translation.
+
+Thomas Fanninger <gogs.thomas@fanninger.at>
\ No newline at end of file
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
"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())
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))
}
os.MkdirAll(setting.AvatarUploadPath, os.ModePerm)
- fw, err := os.Create(savePath)
+ fw, err := os.Create(u.CustomAvatarPath())
if err != nil {
sess.Rollback()
return err
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()
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"))
}
-0.5.8.1121 Beta
\ No newline at end of file
+0.5.8.1122 Beta
\ No newline at end of file