func UpdateIssueTitle(ctx *middleware.Context) { issue := getActionIssue(ctx) if ctx.Written() { return } if !ctx.IsSigned || (ctx.User.Id != issue.PosterID && !ctx.Repo.IsAdmin()) { ctx.Error(403) return } issue.Name = ctx.Query("title") if len(issue.Name) == 0 { ctx.Error(204) return } if err := models.UpdateIssue(issue); err != nil { ctx.Handle(500, "UpdateIssue", err) return } ctx.JSON(200, map[string]interface{}{ "title": issue.Name, }) }
func UpdateIssueContent(ctx *middleware.Context) { issue := getActionIssue(ctx) if ctx.Written() { return } if !ctx.IsSigned || (ctx.User.Id != issue.PosterID && !ctx.Repo.IsAdmin()) { ctx.Error(403) return } issue.Content = ctx.Query("content") if err := models.UpdateIssue(issue); err != nil { ctx.Handle(500, "UpdateIssue", err) return } ctx.JSON(200, map[string]interface{}{ "content": string(base.RenderMarkdown([]byte(issue.Content), ctx.Query("context"))), }) }