From c38754d432c4244a884ccf2576397eb15552b495 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sun, 6 Sep 2015 17:12:02 -0400 Subject: #1191 allow upload avatar for org Signed-off-by: Unknwon --- routers/org/setting.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'routers/org/setting.go') diff --git a/routers/org/setting.go b/routers/org/setting.go index c6d2db3d97..9e26afa7d4 100644 --- a/routers/org/setting.go +++ b/routers/org/setting.go @@ -12,6 +12,7 @@ import ( "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" + "github.com/gogits/gogs/routers/user" ) const ( @@ -73,6 +74,17 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateOrgSettingForm) { ctx.Redirect(org.HomeLink() + "/settings") } +func SettingsAvatar(ctx *middleware.Context, form auth.UploadAvatarForm) { + form.Enable = true + if err := user.UpdateAvatarSetting(ctx, form, ctx.Org.Organization); err != nil { + ctx.Flash.Error(err.Error()) + } else { + ctx.Flash.Success(ctx.Tr("org.settings.update_avatar_success")) + } + + ctx.Redirect(ctx.Org.OrgLink + "/settings") +} + func SettingsDelete(ctx *middleware.Context) { ctx.Data["Title"] = ctx.Tr("org.settings") ctx.Data["PageIsSettingsDelete"] = true -- cgit v1.2.3