aboutsummaryrefslogtreecommitdiffstats
path: root/services/forms
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 /services/forms
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 'services/forms')
-rw-r--r--services/forms/repo_form.go15
-rw-r--r--services/forms/user_form_hidden_comments.go58
2 files changed, 37 insertions, 36 deletions
diff --git a/services/forms/repo_form.go b/services/forms/repo_form.go
index 23ac1abe3c..c9327bbd9b 100644
--- a/services/forms/repo_form.go
+++ b/services/forms/repo_form.go
@@ -11,6 +11,7 @@ import (
"strings"
"code.gitea.io/gitea/models"
+ issues_model "code.gitea.io/gitea/models/issues"
project_model "code.gitea.io/gitea/models/project"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/setting"
@@ -636,18 +637,18 @@ func (f *SubmitReviewForm) Validate(req *http.Request, errs binding.Errors) bind
}
// ReviewType will return the corresponding ReviewType for type
-func (f SubmitReviewForm) ReviewType() models.ReviewType {
+func (f SubmitReviewForm) ReviewType() issues_model.ReviewType {
switch f.Type {
case "approve":
- return models.ReviewTypeApprove
+ return issues_model.ReviewTypeApprove
case "comment":
- return models.ReviewTypeComment
+ return issues_model.ReviewTypeComment
case "reject":
- return models.ReviewTypeReject
+ return issues_model.ReviewTypeReject
case "":
- return models.ReviewTypeComment // default to comment when doing quick-submit (Ctrl+Enter) on the review form
+ return issues_model.ReviewTypeComment // default to comment when doing quick-submit (Ctrl+Enter) on the review form
default:
- return models.ReviewTypeUnknown
+ return issues_model.ReviewTypeUnknown
}
}
@@ -655,7 +656,7 @@ func (f SubmitReviewForm) ReviewType() models.ReviewType {
func (f SubmitReviewForm) HasEmptyContent() bool {
reviewType := f.ReviewType()
- return (reviewType == models.ReviewTypeComment || reviewType == models.ReviewTypeReject) &&
+ return (reviewType == issues_model.ReviewTypeComment || reviewType == issues_model.ReviewTypeReject) &&
len(strings.TrimSpace(f.Content)) == 0
}
diff --git a/services/forms/user_form_hidden_comments.go b/services/forms/user_form_hidden_comments.go
index e0c26e8ddf..35c1a6dd2a 100644
--- a/services/forms/user_form_hidden_comments.go
+++ b/services/forms/user_form_hidden_comments.go
@@ -7,69 +7,69 @@ package forms
import (
"math/big"
- "code.gitea.io/gitea/models"
+ issues_model "code.gitea.io/gitea/models/issues"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
)
-type hiddenCommentTypeGroupsType map[string][]models.CommentType
+type hiddenCommentTypeGroupsType map[string][]issues_model.CommentType
// hiddenCommentTypeGroups maps the group names to comment types, these group names comes from the Web UI (appearance.tmpl)
var hiddenCommentTypeGroups = hiddenCommentTypeGroupsType{
"reference": {
- /*3*/ models.CommentTypeIssueRef,
- /*4*/ models.CommentTypeCommitRef,
- /*5*/ models.CommentTypeCommentRef,
- /*6*/ models.CommentTypePullRef,
+ /*3*/ issues_model.CommentTypeIssueRef,
+ /*4*/ issues_model.CommentTypeCommitRef,
+ /*5*/ issues_model.CommentTypeCommentRef,
+ /*6*/ issues_model.CommentTypePullRef,
},
"label": {
- /*7*/ models.CommentTypeLabel,
+ /*7*/ issues_model.CommentTypeLabel,
},
"milestone": {
- /*8*/ models.CommentTypeMilestone,
+ /*8*/ issues_model.CommentTypeMilestone,
},
"assignee": {
- /*9*/ models.CommentTypeAssignees,
+ /*9*/ issues_model.CommentTypeAssignees,
},
"title": {
- /*10*/ models.CommentTypeChangeTitle,
+ /*10*/ issues_model.CommentTypeChangeTitle,
},
"branch": {
- /*11*/ models.CommentTypeDeleteBranch,
- /*25*/ models.CommentTypeChangeTargetBranch,
+ /*11*/ issues_model.CommentTypeDeleteBranch,
+ /*25*/ issues_model.CommentTypeChangeTargetBranch,
},
"time_tracking": {
- /*12*/ models.CommentTypeStartTracking,
- /*13*/ models.CommentTypeStopTracking,
- /*14*/ models.CommentTypeAddTimeManual,
- /*15*/ models.CommentTypeCancelTracking,
- /*26*/ models.CommentTypeDeleteTimeManual,
+ /*12*/ issues_model.CommentTypeStartTracking,
+ /*13*/ issues_model.CommentTypeStopTracking,
+ /*14*/ issues_model.CommentTypeAddTimeManual,
+ /*15*/ issues_model.CommentTypeCancelTracking,
+ /*26*/ issues_model.CommentTypeDeleteTimeManual,
},
"deadline": {
- /*16*/ models.CommentTypeAddedDeadline,
- /*17*/ models.CommentTypeModifiedDeadline,
- /*18*/ models.CommentTypeRemovedDeadline,
+ /*16*/ issues_model.CommentTypeAddedDeadline,
+ /*17*/ issues_model.CommentTypeModifiedDeadline,
+ /*18*/ issues_model.CommentTypeRemovedDeadline,
},
"dependency": {
- /*19*/ models.CommentTypeAddDependency,
- /*20*/ models.CommentTypeRemoveDependency,
+ /*19*/ issues_model.CommentTypeAddDependency,
+ /*20*/ issues_model.CommentTypeRemoveDependency,
},
"lock": {
- /*23*/ models.CommentTypeLock,
- /*24*/ models.CommentTypeUnlock,
+ /*23*/ issues_model.CommentTypeLock,
+ /*24*/ issues_model.CommentTypeUnlock,
},
"review_request": {
- /*27*/ models.CommentTypeReviewRequest,
+ /*27*/ issues_model.CommentTypeReviewRequest,
},
"pull_request_push": {
- /*29*/ models.CommentTypePullRequestPush,
+ /*29*/ issues_model.CommentTypePullRequestPush,
},
"project": {
- /*30*/ models.CommentTypeProject,
- /*31*/ models.CommentTypeProjectBoard,
+ /*30*/ issues_model.CommentTypeProject,
+ /*31*/ issues_model.CommentTypeProjectBoard,
},
"issue_ref": {
- /*33*/ models.CommentTypeChangeIssueRef,
+ /*33*/ issues_model.CommentTypeChangeIssueRef,
},
}