mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +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:
		| @@ -16,7 +16,7 @@ import ( | ||||
| 	auth_model "code.gitea.io/gitea/models/auth" | ||||
| 	"code.gitea.io/gitea/models/db" | ||||
| 	git_model "code.gitea.io/gitea/models/git" | ||||
| 	"code.gitea.io/gitea/models/issues" | ||||
| 	issues_model "code.gitea.io/gitea/models/issues" | ||||
| 	"code.gitea.io/gitea/models/organization" | ||||
| 	access_model "code.gitea.io/gitea/models/perm/access" | ||||
| 	pull_model "code.gitea.io/gitea/models/pull" | ||||
| @@ -78,12 +78,12 @@ func DeleteUser(ctx context.Context, u *user_model.User) (err error) { | ||||
| 		&user_model.Follow{UserID: u.ID}, | ||||
| 		&user_model.Follow{FollowID: u.ID}, | ||||
| 		&Action{UserID: u.ID}, | ||||
| 		&IssueUser{UID: u.ID}, | ||||
| 		&issues_model.IssueUser{UID: u.ID}, | ||||
| 		&user_model.EmailAddress{UID: u.ID}, | ||||
| 		&user_model.UserOpenID{UID: u.ID}, | ||||
| 		&issues.Reaction{UserID: u.ID}, | ||||
| 		&issues_model.Reaction{UserID: u.ID}, | ||||
| 		&organization.TeamUser{UID: u.ID}, | ||||
| 		&Stopwatch{UserID: u.ID}, | ||||
| 		&issues_model.Stopwatch{UserID: u.ID}, | ||||
| 		&user_model.Setting{UserID: u.ID}, | ||||
| 		&pull_model.AutoMerge{DoerID: u.ID}, | ||||
| 		&pull_model.ReviewState{UserID: u.ID}, | ||||
| @@ -101,8 +101,8 @@ func DeleteUser(ctx context.Context, u *user_model.User) (err error) { | ||||
| 		// Delete Comments | ||||
| 		const batchSize = 50 | ||||
| 		for start := 0; ; start += batchSize { | ||||
| 			comments := make([]*Comment, 0, batchSize) | ||||
| 			if err = e.Where("type=? AND poster_id=?", CommentTypeComment, u.ID).Limit(batchSize, start).Find(&comments); err != nil { | ||||
| 			comments := make([]*issues_model.Comment, 0, batchSize) | ||||
| 			if err = e.Where("type=? AND poster_id=?", issues_model.CommentTypeComment, u.ID).Limit(batchSize, start).Find(&comments); err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| 			if len(comments) == 0 { | ||||
| @@ -110,14 +110,14 @@ func DeleteUser(ctx context.Context, u *user_model.User) (err error) { | ||||
| 			} | ||||
|  | ||||
| 			for _, comment := range comments { | ||||
| 				if err = deleteComment(ctx, comment); err != nil { | ||||
| 				if err = issues_model.DeleteComment(ctx, comment); err != nil { | ||||
| 					return err | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		// Delete Reactions | ||||
| 		if err = issues.DeleteReaction(ctx, &issues.ReactionOptions{DoerID: u.ID}); err != nil { | ||||
| 		if err = issues_model.DeleteReaction(ctx, &issues_model.ReactionOptions{DoerID: u.ID}); err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 	} | ||||
| @@ -189,7 +189,7 @@ func DeleteUser(ctx context.Context, u *user_model.User) (err error) { | ||||
| 	// ***** END: GPGPublicKey ***** | ||||
|  | ||||
| 	// Clear assignee. | ||||
| 	if _, err = db.DeleteByBean(ctx, &IssueAssignees{AssigneeID: u.ID}); err != nil { | ||||
| 	if _, err = db.DeleteByBean(ctx, &issues_model.IssueAssignees{AssigneeID: u.ID}); err != nil { | ||||
| 		return fmt.Errorf("clear assignee: %v", err) | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Lunny Xiao
					Lunny Xiao