summaryrefslogtreecommitdiffstats
path: root/models/issue.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-10-15 13:03:05 +0800
committerGitHub <noreply@github.com>2019-10-15 13:03:05 +0800
commit20477a69ea123a7800ebf94bfd2225eb9ae90e8f (patch)
tree0e01914d69bd5dbda358c7c5ce90c375e0f29be0 /models/issue.go
parent34fb9d68a5567423ddde736ff42f9780f4048366 (diff)
downloadgitea-20477a69ea123a7800ebf94bfd2225eb9ae90e8f.tar.gz
gitea-20477a69ea123a7800ebf94bfd2225eb9ae90e8f.zip
Move clearlabels from models to issue service (#8326)
* move clearlabels from models to issue service * improve code * Apply suggestions from code review Co-Authored-By: zeripath <art27@cantab.net>
Diffstat (limited to 'models/issue.go')
-rw-r--r--models/issue.go34
1 files changed, 0 insertions, 34 deletions
diff --git a/models/issue.go b/models/issue.go
index fc675a3ffb..90925f92f5 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -596,40 +596,6 @@ func (issue *Issue) ClearLabels(doer *User) (err error) {
if err = sess.Commit(); err != nil {
return fmt.Errorf("Commit: %v", err)
}
- sess.Close()
-
- if err = issue.LoadPoster(); err != nil {
- return fmt.Errorf("loadPoster: %v", err)
- }
-
- mode, _ := AccessLevel(issue.Poster, issue.Repo)
- if issue.IsPull {
- err = issue.PullRequest.LoadIssue()
- if err != nil {
- log.Error("LoadIssue: %v", err)
- return
- }
- err = PrepareWebhooks(issue.Repo, HookEventPullRequest, &api.PullRequestPayload{
- Action: api.HookIssueLabelCleared,
- Index: issue.Index,
- PullRequest: issue.PullRequest.APIFormat(),
- Repository: issue.Repo.APIFormat(mode),
- Sender: doer.APIFormat(),
- })
- } else {
- err = PrepareWebhooks(issue.Repo, HookEventIssues, &api.IssuePayload{
- Action: api.HookIssueLabelCleared,
- Index: issue.Index,
- Issue: issue.APIFormat(),
- Repository: issue.Repo.APIFormat(mode),
- Sender: doer.APIFormat(),
- })
- }
- if err != nil {
- log.Error("PrepareWebhooks [is_pull: %v]: %v", issue.IsPull, err)
- } else {
- go HookQueue.Add(issue.RepoID)
- }
return nil
}