@@ -71,11 +71,11 @@ type Reaction struct {
71
71
}
72
72
73
73
// LoadUser load user of reaction
74
- func (r * Reaction ) LoadUser () (* user_model.User , error ) {
74
+ func (r * Reaction ) LoadUser (ctx context. Context ) (* user_model.User , error ) {
75
75
if r .User != nil {
76
76
return r .User , nil
77
77
}
78
- user , err := user_model .GetUserByID (db . DefaultContext , r .UserID )
78
+ user , err := user_model .GetUserByID (ctx , r .UserID )
79
79
if err != nil {
80
80
return nil , err
81
81
}
@@ -141,16 +141,16 @@ func (opts *FindReactionsOptions) toConds() builder.Cond {
141
141
}
142
142
143
143
// FindCommentReactions returns a ReactionList of all reactions from an comment
144
- func FindCommentReactions (issueID , commentID int64 ) (ReactionList , int64 , error ) {
145
- return FindReactions (db . DefaultContext , FindReactionsOptions {
144
+ func FindCommentReactions (ctx context. Context , issueID , commentID int64 ) (ReactionList , int64 , error ) {
145
+ return FindReactions (ctx , FindReactionsOptions {
146
146
IssueID : issueID ,
147
147
CommentID : commentID ,
148
148
})
149
149
}
150
150
151
151
// FindIssueReactions returns a ReactionList of all reactions from an issue
152
- func FindIssueReactions (issueID int64 , listOptions db.ListOptions ) (ReactionList , int64 , error ) {
153
- return FindReactions (db . DefaultContext , FindReactionsOptions {
152
+ func FindIssueReactions (ctx context. Context , issueID int64 , listOptions db.ListOptions ) (ReactionList , int64 , error ) {
153
+ return FindReactions (ctx , FindReactionsOptions {
154
154
ListOptions : listOptions ,
155
155
IssueID : issueID ,
156
156
CommentID : - 1 ,
@@ -218,12 +218,12 @@ type ReactionOptions struct {
218
218
}
219
219
220
220
// CreateReaction creates reaction for issue or comment.
221
- func CreateReaction (opts * ReactionOptions ) (* Reaction , error ) {
221
+ func CreateReaction (ctx context. Context , opts * ReactionOptions ) (* Reaction , error ) {
222
222
if ! setting .UI .ReactionsLookup .Contains (opts .Type ) {
223
223
return nil , ErrForbiddenIssueReaction {opts .Type }
224
224
}
225
225
226
- ctx , committer , err := db .TxContext (db . DefaultContext )
226
+ ctx , committer , err := db .TxContext (ctx )
227
227
if err != nil {
228
228
return nil , err
229
229
}
@@ -241,17 +241,17 @@ func CreateReaction(opts *ReactionOptions) (*Reaction, error) {
241
241
}
242
242
243
243
// CreateIssueReaction creates a reaction on issue.
244
- func CreateIssueReaction (doerID , issueID int64 , content string ) (* Reaction , error ) {
245
- return CreateReaction (& ReactionOptions {
244
+ func CreateIssueReaction (ctx context. Context , doerID , issueID int64 , content string ) (* Reaction , error ) {
245
+ return CreateReaction (ctx , & ReactionOptions {
246
246
Type : content ,
247
247
DoerID : doerID ,
248
248
IssueID : issueID ,
249
249
})
250
250
}
251
251
252
252
// CreateCommentReaction creates a reaction on comment.
253
- func CreateCommentReaction (doerID , issueID , commentID int64 , content string ) (* Reaction , error ) {
254
- return CreateReaction (& ReactionOptions {
253
+ func CreateCommentReaction (ctx context. Context , doerID , issueID , commentID int64 , content string ) (* Reaction , error ) {
254
+ return CreateReaction (ctx , & ReactionOptions {
255
255
Type : content ,
256
256
DoerID : doerID ,
257
257
IssueID : issueID ,
@@ -279,8 +279,8 @@ func DeleteReaction(ctx context.Context, opts *ReactionOptions) error {
279
279
}
280
280
281
281
// DeleteIssueReaction deletes a reaction on issue.
282
- func DeleteIssueReaction (doerID , issueID int64 , content string ) error {
283
- return DeleteReaction (db . DefaultContext , & ReactionOptions {
282
+ func DeleteIssueReaction (ctx context. Context , doerID , issueID int64 , content string ) error {
283
+ return DeleteReaction (ctx , & ReactionOptions {
284
284
Type : content ,
285
285
DoerID : doerID ,
286
286
IssueID : issueID ,
@@ -289,8 +289,8 @@ func DeleteIssueReaction(doerID, issueID int64, content string) error {
289
289
}
290
290
291
291
// DeleteCommentReaction deletes a reaction on comment.
292
- func DeleteCommentReaction (doerID , issueID , commentID int64 , content string ) error {
293
- return DeleteReaction (db . DefaultContext , & ReactionOptions {
292
+ func DeleteCommentReaction (ctx context. Context , doerID , issueID , commentID int64 , content string ) error {
293
+ return DeleteReaction (ctx , & ReactionOptions {
294
294
Type : content ,
295
295
DoerID : doerID ,
296
296
IssueID : issueID ,
0 commit comments