Skip to content

Commit 24b6efc

Browse files
committed
Revert "[API] fix deleting an issue when the git repo does not exist"
replaced by d00af6130 Remove unnecessary prefix usage (go-gitea#24888) This reverts commit 985e378.
1 parent a1776ee commit 24b6efc

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

services/issue/issue.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
package issue
55

66
import (
7-
"context"
87
"fmt"
98

109
activities_model "code.gitea.io/gitea/models/activities"
@@ -133,17 +132,11 @@ func UpdateAssignees(issue *issues_model.Issue, oneAssignee string, multipleAssi
133132

134133
// DeleteIssue deletes an issue
135134
func DeleteIssue(doer *user_model.User, gitRepo *git.Repository, issue *issues_model.Issue) error {
136-
var ctx context.Context
137-
if gitRepo == nil {
138-
ctx = db.DefaultContext
139-
} else {
140-
ctx = gitRepo.Ctx
141-
}
142135
// load issue before deleting it
143-
if err := issue.LoadAttributes(ctx); err != nil {
136+
if err := issue.LoadAttributes(gitRepo.Ctx); err != nil {
144137
return err
145138
}
146-
if err := issue.LoadPullRequest(ctx); err != nil {
139+
if err := issue.LoadPullRequest(gitRepo.Ctx); err != nil {
147140
return err
148141
}
149142

@@ -159,7 +152,7 @@ func DeleteIssue(doer *user_model.User, gitRepo *git.Repository, issue *issues_m
159152
}
160153
}
161154

162-
notification.NotifyDeleteIssue(ctx, doer, issue)
155+
notification.NotifyDeleteIssue(gitRepo.Ctx, doer, issue)
163156

164157
return nil
165158
}

0 commit comments

Comments
 (0)