diff options
Diffstat (limited to 'modules/auth')
-rw-r--r-- | modules/auth/apiv1/miscellaneous.go | 6 | ||||
-rw-r--r-- | modules/auth/auth.go | 4 | ||||
-rw-r--r-- | modules/auth/repo_form.go | 21 |
3 files changed, 21 insertions, 10 deletions
diff --git a/modules/auth/apiv1/miscellaneous.go b/modules/auth/apiv1/miscellaneous.go index 4e757005..e05b4838 100644 --- a/modules/auth/apiv1/miscellaneous.go +++ b/modules/auth/apiv1/miscellaneous.go @@ -14,9 +14,9 @@ import ( ) type MarkdownForm struct { - Text string `form:"text"` - Mode string `form:"mode"` - Context string `form:"context"` + Text string + Mode string + Context string } func (f *MarkdownForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { diff --git a/modules/auth/auth.go b/modules/auth/auth.go index 7e01abc3..92bcd720 100644 --- a/modules/auth/auth.go +++ b/modules/auth/auth.go @@ -54,7 +54,7 @@ func SignedInId(req *http.Request, sess session.Store) int64 { return 0 } if id, ok := uid.(int64); ok { - if _, err := models.GetUserById(id); err != nil { + if _, err := models.GetUserByID(id); err != nil { if !models.IsErrUserNotExist(err) { log.Error(4, "GetUserById: %v", err) } @@ -127,7 +127,7 @@ func SignedInUser(req *http.Request, sess session.Store) (*models.User, bool) { return nil, false } - u, err := models.GetUserById(uid) + u, err := models.GetUserByID(uid) if err != nil { log.Error(4, "GetUserById: %v", err) return nil, false diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index 98639021..cbabbb46 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -98,17 +98,28 @@ func (f *NewSlackHookForm) Validate(ctx *macaron.Context, errs binding.Errors) b // \/ \/ \/ type CreateIssueForm struct { - IssueName string `form:"title" binding:"Required;MaxSize(255)"` - MilestoneId int64 `form:"milestoneid"` - AssigneeId int64 `form:"assigneeid"` - Labels string `form:"labels"` - Content string `form:"content"` + Title string `binding:"Required;MaxSize(255)"` + LabelIDs string `form:"label_ids"` + MilestoneID int64 + AssigneeID int64 + Content string + Attachments []string } func (f *CreateIssueForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { return validate(errs, ctx.Data, f, ctx.Locale) } +type CreateCommentForm struct { + Content string + Status string `binding:"OmitEmpty;In(reopen,close)"` + Attachments []string +} + +func (f *CreateCommentForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { + return validate(errs, ctx.Data, f, ctx.Locale) +} + // _____ .__.__ __ // / \ |__| | ____ _______/ |_ ____ ____ ____ // / \ / \| | | _/ __ \ / ___/\ __\/ _ \ / \_/ __ \ |