aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/issue_reaction.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-06-13 17:37:59 +0800
committerGitHub <noreply@github.com>2022-06-13 17:37:59 +0800
commit1a9821f57a0293db3adc0eab8aff08ca5fa1026c (patch)
tree3c3d02813eb63c0d0827ef6d9745f6dcdd2636cb /routers/api/v1/repo/issue_reaction.go
parent3708ca8e2849ca7e36e6bd15ec6935a2a2d81e55 (diff)
downloadgitea-1a9821f57a0293db3adc0eab8aff08ca5fa1026c.tar.gz
gitea-1a9821f57a0293db3adc0eab8aff08ca5fa1026c.zip
Move issues related files into models/issues (#19931)
* Move access and repo permission to models/perm/access * fix test * fix git test * Move functions sequence * Some improvements per @KN4CK3R and @delvh * Move issues related code to models/issues * Move some issues related sub package * Merge * Fix test * Fix test * Fix test * Fix test * Rename some files
Diffstat (limited to 'routers/api/v1/repo/issue_reaction.go')
-rw-r--r--routers/api/v1/repo/issue_reaction.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/routers/api/v1/repo/issue_reaction.go b/routers/api/v1/repo/issue_reaction.go
index 45be7a92dd..f4c40d2bcd 100644
--- a/routers/api/v1/repo/issue_reaction.go
+++ b/routers/api/v1/repo/issue_reaction.go
@@ -8,7 +8,6 @@ import (
"errors"
"net/http"
- "code.gitea.io/gitea/models"
issues_model "code.gitea.io/gitea/models/issues"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/convert"
@@ -49,9 +48,9 @@ func GetIssueCommentReactions(ctx *context.APIContext) {
// "403":
// "$ref": "#/responses/forbidden"
- comment, err := models.GetCommentByID(ctx, ctx.ParamsInt64(":id"))
+ comment, err := issues_model.GetCommentByID(ctx, ctx.ParamsInt64(":id"))
if err != nil {
- if models.IsErrCommentNotExist(err) {
+ if issues_model.IsErrCommentNotExist(err) {
ctx.NotFound(err)
} else {
ctx.Error(http.StatusInternalServerError, "GetCommentByID", err)
@@ -176,9 +175,9 @@ func DeleteIssueCommentReaction(ctx *context.APIContext) {
}
func changeIssueCommentReaction(ctx *context.APIContext, form api.EditReactionOption, isCreateType bool) {
- comment, err := models.GetCommentByID(ctx, ctx.ParamsInt64(":id"))
+ comment, err := issues_model.GetCommentByID(ctx, ctx.ParamsInt64(":id"))
if err != nil {
- if models.IsErrCommentNotExist(err) {
+ if issues_model.IsErrCommentNotExist(err) {
ctx.NotFound(err)
} else {
ctx.Error(http.StatusInternalServerError, "GetCommentByID", err)
@@ -271,9 +270,9 @@ func GetIssueReactions(ctx *context.APIContext) {
// "403":
// "$ref": "#/responses/forbidden"
- issue, err := models.GetIssueWithAttrsByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
+ issue, err := issues_model.GetIssueWithAttrsByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
- if models.IsErrIssueNotExist(err) {
+ if issues_model.IsErrIssueNotExist(err) {
ctx.NotFound()
} else {
ctx.Error(http.StatusInternalServerError, "GetIssueByIndex", err)
@@ -391,9 +390,9 @@ func DeleteIssueReaction(ctx *context.APIContext) {
}
func changeIssueReaction(ctx *context.APIContext, form api.EditReactionOption, isCreateType bool) {
- issue, err := models.GetIssueWithAttrsByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
+ issue, err := issues_model.GetIssueWithAttrsByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
- if models.IsErrIssueNotExist(err) {
+ if issues_model.IsErrIssueNotExist(err) {
ctx.NotFound()
} else {
ctx.Error(http.StatusInternalServerError, "GetIssueByIndex", err)