mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 00:20:25 +08:00 
			
		
		
		
	Delete related PullAutoMerge and ReviewState on User/Repo Deletion (#19649)
* delete pullautomerges on repo/user deletion * delete reviewstates on repo/user deletion * optimize automerhe code * add index to reviewstate
This commit is contained in:
		@@ -10,6 +10,7 @@ import (
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"code.gitea.io/gitea/models"
 | 
			
		||||
	"code.gitea.io/gitea/models/db"
 | 
			
		||||
	"code.gitea.io/gitea/models/unit"
 | 
			
		||||
	user_model "code.gitea.io/gitea/models/user"
 | 
			
		||||
	"code.gitea.io/gitea/modules/context"
 | 
			
		||||
@@ -281,7 +282,7 @@ func ResetIssueTime(ctx *context.APIContext) {
 | 
			
		||||
 | 
			
		||||
	err = models.DeleteIssueUserTimes(issue, ctx.Doer)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		if models.IsErrNotExist(err) {
 | 
			
		||||
		if db.IsErrNotExist(err) {
 | 
			
		||||
			ctx.Error(http.StatusNotFound, "DeleteIssueUserTimes", err)
 | 
			
		||||
		} else {
 | 
			
		||||
			ctx.Error(http.StatusInternalServerError, "DeleteIssueUserTimes", err)
 | 
			
		||||
@@ -352,7 +353,7 @@ func DeleteTime(ctx *context.APIContext) {
 | 
			
		||||
 | 
			
		||||
	time, err := models.GetTrackedTimeByID(ctx.ParamsInt64(":id"))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		if models.IsErrNotExist(err) {
 | 
			
		||||
		if db.IsErrNotExist(err) {
 | 
			
		||||
			ctx.NotFound(err)
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user