mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 19:38:23 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -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 | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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, | ||||
| 	}, | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user