@@ -36,61 +36,35 @@ func (r *indexerNotifier) NotifyAdoptRepository(ctx context.Context, doer, u *us
36
36
func (r * indexerNotifier ) NotifyCreateIssueComment (ctx context.Context , doer * user_model.User , repo * repo_model.Repository ,
37
37
issue * issues_model.Issue , comment * issues_model.Comment , mentions []* user_model.User ,
38
38
) {
39
- if comment .Type == issues_model .CommentTypeComment {
40
- if issue .Comments == nil {
41
- if err := issue .LoadDiscussComments (ctx ); err != nil {
42
- log .Error ("LoadDiscussComments failed: %v" , err )
43
- return
44
- }
45
- } else {
46
- issue .Comments = append (issue .Comments , comment )
47
- }
48
-
49
- issue_indexer .UpdateIssueIndexer (issue .ID )
50
- }
39
+ issue_indexer .UpdateIssueIndexer (issue .ID )
51
40
}
52
41
53
42
func (r * indexerNotifier ) NotifyNewIssue (ctx context.Context , issue * issues_model.Issue , mentions []* user_model.User ) {
54
43
issue_indexer .UpdateIssueIndexer (issue .ID )
55
44
}
56
45
57
46
func (r * indexerNotifier ) NotifyNewPullRequest (ctx context.Context , pr * issues_model.PullRequest , mentions []* user_model.User ) {
47
+ if err := pr .LoadIssue (ctx ); err != nil {
48
+ log .Error ("LoadIssue: %v" , err )
49
+ return
50
+ }
58
51
issue_indexer .UpdateIssueIndexer (pr .Issue .ID )
59
52
}
60
53
61
54
func (r * indexerNotifier ) NotifyUpdateComment (ctx context.Context , doer * user_model.User , c * issues_model.Comment , oldContent string ) {
62
- // Whatever the comment type is, just update the issue indexer.
63
- // So that the issue indexer will be updated when Status/Assignee/Label and so on changed.
55
+ if err := c .LoadIssue (ctx ); err != nil {
56
+ log .Error ("LoadIssue: %v" , err )
57
+ return
58
+ }
64
59
issue_indexer .UpdateIssueIndexer (c .Issue .ID )
65
60
}
66
61
67
62
func (r * indexerNotifier ) NotifyDeleteComment (ctx context.Context , doer * user_model.User , comment * issues_model.Comment ) {
68
- if comment .Type == issues_model .CommentTypeComment {
69
- if err := comment .LoadIssue (ctx ); err != nil {
70
- log .Error ("LoadIssue: %v" , err )
71
- return
72
- }
73
-
74
- var found bool
75
- if comment .Issue .Comments != nil {
76
- for i := 0 ; i < len (comment .Issue .Comments ); i ++ {
77
- if comment .Issue .Comments [i ].ID == comment .ID {
78
- comment .Issue .Comments = append (comment .Issue .Comments [:i ], comment .Issue .Comments [i + 1 :]... )
79
- found = true
80
- break
81
- }
82
- }
83
- }
84
-
85
- if ! found {
86
- if err := comment .Issue .LoadDiscussComments (ctx ); err != nil {
87
- log .Error ("LoadDiscussComments failed: %v" , err )
88
- return
89
- }
90
- }
91
- // reload comments to delete the old comment
92
- issue_indexer .UpdateIssueIndexer (comment .Issue .ID )
63
+ if err := comment .LoadIssue (ctx ); err != nil {
64
+ log .Error ("LoadIssue: %v" , err )
65
+ return
93
66
}
67
+ issue_indexer .UpdateIssueIndexer (comment .Issue .ID )
94
68
}
95
69
96
70
func (r * indexerNotifier ) NotifyDeleteRepository (ctx context.Context , doer * user_model.User , repo * repo_model.Repository ) {
0 commit comments