Revert "[API] fix deleting an issue when the git repo does not exist"
replaced by d00af6130 Remove unnecessary prefix usage (#24888)
This reverts commit 985e378272
.
This commit is contained in:
parent
a1776ee351
commit
24b6efc2fb
|
@ -4,7 +4,6 @@
|
||||||
package issue
|
package issue
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
activities_model "code.gitea.io/gitea/models/activities"
|
activities_model "code.gitea.io/gitea/models/activities"
|
||||||
|
@ -133,17 +132,11 @@ func UpdateAssignees(issue *issues_model.Issue, oneAssignee string, multipleAssi
|
||||||
|
|
||||||
// DeleteIssue deletes an issue
|
// DeleteIssue deletes an issue
|
||||||
func DeleteIssue(doer *user_model.User, gitRepo *git.Repository, issue *issues_model.Issue) error {
|
func DeleteIssue(doer *user_model.User, gitRepo *git.Repository, issue *issues_model.Issue) error {
|
||||||
var ctx context.Context
|
|
||||||
if gitRepo == nil {
|
|
||||||
ctx = db.DefaultContext
|
|
||||||
} else {
|
|
||||||
ctx = gitRepo.Ctx
|
|
||||||
}
|
|
||||||
// load issue before deleting it
|
// load issue before deleting it
|
||||||
if err := issue.LoadAttributes(ctx); err != nil {
|
if err := issue.LoadAttributes(gitRepo.Ctx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := issue.LoadPullRequest(ctx); err != nil {
|
if err := issue.LoadPullRequest(gitRepo.Ctx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +152,7 @@ func DeleteIssue(doer *user_model.User, gitRepo *git.Repository, issue *issues_m
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notification.NotifyDeleteIssue(ctx, doer, issue)
|
notification.NotifyDeleteIssue(gitRepo.Ctx, doer, issue)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue