|
|
|
@ -8,13 +8,14 @@ import (
|
|
|
|
|
api "github.com/gogits/go-gogs-client" |
|
|
|
|
|
|
|
|
|
"github.com/gogits/gogs/models" |
|
|
|
|
"github.com/gogits/gogs/models/errors" |
|
|
|
|
"github.com/gogits/gogs/modules/context" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
func ListIssueLabels(ctx *context.APIContext) { |
|
|
|
|
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) |
|
|
|
|
if err != nil { |
|
|
|
|
if models.IsErrIssueNotExist(err) { |
|
|
|
|
if errors.IsIssueNotExist(err) { |
|
|
|
|
ctx.Status(404) |
|
|
|
|
} else { |
|
|
|
|
ctx.Error(500, "GetIssueByIndex", err) |
|
|
|
@ -37,7 +38,7 @@ func AddIssueLabels(ctx *context.APIContext, form api.IssueLabelsOption) {
|
|
|
|
|
|
|
|
|
|
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) |
|
|
|
|
if err != nil { |
|
|
|
|
if models.IsErrIssueNotExist(err) { |
|
|
|
|
if errors.IsIssueNotExist(err) { |
|
|
|
|
ctx.Status(404) |
|
|
|
|
} else { |
|
|
|
|
ctx.Error(500, "GetIssueByIndex", err) |
|
|
|
@ -77,7 +78,7 @@ func DeleteIssueLabel(ctx *context.APIContext) {
|
|
|
|
|
|
|
|
|
|
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) |
|
|
|
|
if err != nil { |
|
|
|
|
if models.IsErrIssueNotExist(err) { |
|
|
|
|
if errors.IsIssueNotExist(err) { |
|
|
|
|
ctx.Status(404) |
|
|
|
|
} else { |
|
|
|
|
ctx.Error(500, "GetIssueByIndex", err) |
|
|
|
@ -111,7 +112,7 @@ func ReplaceIssueLabels(ctx *context.APIContext, form api.IssueLabelsOption) {
|
|
|
|
|
|
|
|
|
|
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) |
|
|
|
|
if err != nil { |
|
|
|
|
if models.IsErrIssueNotExist(err) { |
|
|
|
|
if errors.IsIssueNotExist(err) { |
|
|
|
|
ctx.Status(404) |
|
|
|
|
} else { |
|
|
|
|
ctx.Error(500, "GetIssueByIndex", err) |
|
|
|
@ -151,7 +152,7 @@ func ClearIssueLabels(ctx *context.APIContext) {
|
|
|
|
|
|
|
|
|
|
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) |
|
|
|
|
if err != nil { |
|
|
|
|
if models.IsErrIssueNotExist(err) { |
|
|
|
|
if errors.IsIssueNotExist(err) { |
|
|
|
|
ctx.Status(404) |
|
|
|
|
} else { |
|
|
|
|
ctx.Error(500, "GetIssueByIndex", err) |
|
|
|
|