diff options
author | 6543 <6543@obermui.de> | 2021-09-10 18:03:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-10 18:03:16 +0200 |
commit | 51578d64188a7077848cb60d3ead8e818637ab59 (patch) | |
tree | 7dc50e490b6b0ad759fb859830ef06ef7ba4c713 /routers/api | |
parent | 9a938dc2980667bf4cbdb3af45c32f561af4bec4 (diff) | |
download | gitea-51578d64188a7077848cb60d3ead8e818637ab59.tar.gz gitea-51578d64188a7077848cb60d3ead8e818637ab59.zip |
Calculate label URL on API (#16186)
close #8028
Diffstat (limited to 'routers/api')
-rw-r--r-- | routers/api/v1/org/label.go | 10 | ||||
-rw-r--r-- | routers/api/v1/repo/issue_label.go | 6 | ||||
-rw-r--r-- | routers/api/v1/repo/label.go | 10 |
3 files changed, 15 insertions, 11 deletions
diff --git a/routers/api/v1/org/label.go b/routers/api/v1/org/label.go index 09acb0bf04..b375284189 100644 --- a/routers/api/v1/org/label.go +++ b/routers/api/v1/org/label.go @@ -56,7 +56,7 @@ func ListLabels(ctx *context.APIContext) { } ctx.SetTotalCountHeader(count) - ctx.JSON(http.StatusOK, convert.ToLabelList(labels)) + ctx.JSON(http.StatusOK, convert.ToLabelList(labels, nil, ctx.Org.Organization)) } // CreateLabel create a label for a repository @@ -103,7 +103,8 @@ func CreateLabel(ctx *context.APIContext) { ctx.Error(http.StatusInternalServerError, "NewLabel", err) return } - ctx.JSON(http.StatusCreated, convert.ToLabel(label)) + + ctx.JSON(http.StatusCreated, convert.ToLabel(label, nil, ctx.Org.Organization)) } // GetLabel get label by organization and label id @@ -148,7 +149,7 @@ func GetLabel(ctx *context.APIContext) { return } - ctx.JSON(http.StatusOK, convert.ToLabel(label)) + ctx.JSON(http.StatusOK, convert.ToLabel(label, nil, ctx.Org.Organization)) } // EditLabel modify a label for an Organization @@ -212,7 +213,8 @@ func EditLabel(ctx *context.APIContext) { ctx.Error(http.StatusInternalServerError, "UpdateLabel", err) return } - ctx.JSON(http.StatusOK, convert.ToLabel(label)) + + ctx.JSON(http.StatusOK, convert.ToLabel(label, nil, ctx.Org.Organization)) } // DeleteLabel delete a label for an organization diff --git a/routers/api/v1/repo/issue_label.go b/routers/api/v1/repo/issue_label.go index d7f64b2d99..0469ae247c 100644 --- a/routers/api/v1/repo/issue_label.go +++ b/routers/api/v1/repo/issue_label.go @@ -61,7 +61,7 @@ func ListIssueLabels(ctx *context.APIContext) { return } - ctx.JSON(http.StatusOK, convert.ToLabelList(issue.Labels)) + ctx.JSON(http.StatusOK, convert.ToLabelList(issue.Labels, ctx.Repo.Repository, ctx.Repo.Owner)) } // AddIssueLabels add labels for an issue @@ -117,7 +117,7 @@ func AddIssueLabels(ctx *context.APIContext) { return } - ctx.JSON(http.StatusOK, convert.ToLabelList(labels)) + ctx.JSON(http.StatusOK, convert.ToLabelList(labels, ctx.Repo.Repository, ctx.Repo.Owner)) } // DeleteIssueLabel delete a label for an issue @@ -243,7 +243,7 @@ func ReplaceIssueLabels(ctx *context.APIContext) { return } - ctx.JSON(http.StatusOK, convert.ToLabelList(labels)) + ctx.JSON(http.StatusOK, convert.ToLabelList(labels, ctx.Repo.Repository, ctx.Repo.Owner)) } // ClearIssueLabels delete all the labels for an issue diff --git a/routers/api/v1/repo/label.go b/routers/api/v1/repo/label.go index 1de5705aa2..67682fc60d 100644 --- a/routers/api/v1/repo/label.go +++ b/routers/api/v1/repo/label.go @@ -62,7 +62,7 @@ func ListLabels(ctx *context.APIContext) { } ctx.SetTotalCountHeader(count) - ctx.JSON(http.StatusOK, convert.ToLabelList(labels)) + ctx.JSON(http.StatusOK, convert.ToLabelList(labels, ctx.Repo.Repository, nil)) } // GetLabel get label by repository and label id @@ -112,7 +112,7 @@ func GetLabel(ctx *context.APIContext) { return } - ctx.JSON(http.StatusOK, convert.ToLabel(label)) + ctx.JSON(http.StatusOK, convert.ToLabel(label, ctx.Repo.Repository, nil)) } // CreateLabel create a label for a repository @@ -165,7 +165,8 @@ func CreateLabel(ctx *context.APIContext) { ctx.Error(http.StatusInternalServerError, "NewLabel", err) return } - ctx.JSON(http.StatusCreated, convert.ToLabel(label)) + + ctx.JSON(http.StatusCreated, convert.ToLabel(label, ctx.Repo.Repository, nil)) } // EditLabel modify a label for a repository @@ -235,7 +236,8 @@ func EditLabel(ctx *context.APIContext) { ctx.Error(http.StatusInternalServerError, "UpdateLabel", err) return } - ctx.JSON(http.StatusOK, convert.ToLabel(label)) + + ctx.JSON(http.StatusOK, convert.ToLabel(label, ctx.Repo.Repository, nil)) } // DeleteLabel delete a label for a repository |