diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-01-17 22:23:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-17 22:23:22 +0800 |
commit | 82e08a3364195b515a005180c2bdc08e78aac208 (patch) | |
tree | f8ae9f914ab522224e57fcf94675a7f7dd39006e /models | |
parent | 477a80f658a04fc477d800887c55654ac307ff45 (diff) | |
download | gitea-82e08a3364195b515a005180c2bdc08e78aac208.tar.gz gitea-82e08a3364195b515a005180c2bdc08e78aac208.zip |
Refactor notification for indexer (#5111)
* notification for indexer
* use NullNotifier as parent struct
Diffstat (limited to 'models')
-rw-r--r-- | models/issue.go | 3 | ||||
-rw-r--r-- | models/issue_comment.go | 7 | ||||
-rw-r--r-- | models/issue_indexer.go | 4 | ||||
-rw-r--r-- | models/pull.go | 2 |
4 files changed, 1 insertions, 15 deletions
diff --git a/models/issue.go b/models/issue.go index 4f03ed926e..baca512ab0 100644 --- a/models/issue.go +++ b/models/issue.go @@ -1112,8 +1112,6 @@ func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, assigneeIDs []in return fmt.Errorf("Commit: %v", err) } - UpdateIssueIndexer(issue.ID) - if err = NotifyWatchers(&Action{ ActUserID: issue.Poster.ID, ActUser: issue.Poster, @@ -1652,7 +1650,6 @@ func updateIssue(e Engine, issue *Issue) error { if err != nil { return err } - UpdateIssueIndexer(issue.ID) return nil } diff --git a/models/issue_comment.go b/models/issue_comment.go index 0e40e442b6..6c87650a3c 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -818,9 +818,6 @@ func CreateComment(opts *CreateCommentOptions) (comment *Comment, err error) { return nil, err } - if opts.Type == CommentTypeComment { - UpdateIssueIndexer(opts.Issue.ID) - } return comment, nil } @@ -1022,8 +1019,6 @@ func GetCommentsByRepoIDSince(repoID, since int64) ([]*Comment, error) { func UpdateComment(doer *User, c *Comment, oldContent string) error { if _, err := x.ID(c.ID).AllCols().Update(c); err != nil { return err - } else if c.Type == CommentTypeComment { - UpdateIssueIndexer(c.IssueID) } if err := c.LoadPoster(); err != nil { @@ -1082,8 +1077,6 @@ func DeleteComment(doer *User, comment *Comment) error { if err := sess.Commit(); err != nil { return err - } else if comment.Type == CommentTypeComment { - UpdateIssueIndexer(comment.IssueID) } if err := comment.LoadPoster(); err != nil { diff --git a/models/issue_indexer.go b/models/issue_indexer.go index b94ba5f2df..48c0b9f246 100644 --- a/models/issue_indexer.go +++ b/models/issue_indexer.go @@ -117,9 +117,7 @@ func updateNeededCols(cols []string) bool { // UpdateIssueIndexerCols update an issue in the issue indexer, given changes // to the specified columns func UpdateIssueIndexerCols(issueID int64, cols ...string) { - if updateNeededCols(cols) { - UpdateIssueIndexer(issueID) - } + updateNeededCols(cols) } // UpdateIssueIndexer add/update an issue to the issue indexer diff --git a/models/pull.go b/models/pull.go index e1a8b14e45..8b4961d8b6 100644 --- a/models/pull.go +++ b/models/pull.go @@ -833,8 +833,6 @@ func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []str return fmt.Errorf("Commit: %v", err) } - UpdateIssueIndexer(pull.ID) - if err = NotifyWatchers(&Action{ ActUserID: pull.Poster.ID, ActUser: pull.Poster, |