router/repo: code refactoring

This commit is contained in:
Unknwon
2016-08-30 02:08:38 -07:00
parent 2a13f682e0
commit 780cc2d110
13 changed files with 253 additions and 261 deletions

View File

@ -795,7 +795,7 @@ func UpdateIssueAssignee(ctx *context.Context) {
func NewComment(ctx *context.Context, form auth.CreateCommentForm) {
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
ctx.HandleError("GetIssueByIndex", models.IsErrIssueNotExist, err, 404)
ctx.NotFoundOrServerError("GetIssueByIndex", models.IsErrIssueNotExist, err)
return
}
@ -881,7 +881,7 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) {
func UpdateCommentContent(ctx *context.Context) {
comment, err := models.GetCommentByID(ctx.ParamsInt64(":id"))
if err != nil {
ctx.HandleError("GetCommentByID", models.IsErrCommentNotExist, err, 404)
ctx.NotFoundOrServerError("GetCommentByID", models.IsErrCommentNotExist, err)
return
}
@ -913,7 +913,7 @@ func UpdateCommentContent(ctx *context.Context) {
func DeleteComment(ctx *context.Context) {
comment, err := models.GetCommentByID(ctx.ParamsInt64(":id"))
if err != nil {
ctx.HandleError("GetCommentByID", models.IsErrCommentNotExist, err, 404)
ctx.NotFoundOrServerError("GetCommentByID", models.IsErrCommentNotExist, err)
return
}