Skip to content

Commit d034190

Browse files
committed
improve code
1 parent 19ca47a commit d034190

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

models/issues/reaction.go

+5-7
Original file line numberDiff line numberDiff line change
@@ -170,20 +170,18 @@ func FindReactions(ctx context.Context, opts FindReactionsOptions) (ReactionList
170170

171171
func createReaction(ctx context.Context, opts *ReactionOptions) (*Reaction, error) {
172172
reaction := &Reaction{
173-
Type: opts.Type,
174-
UserID: opts.DoerID,
175-
IssueID: opts.IssueID,
173+
Type: opts.Type,
174+
UserID: opts.DoerID,
175+
IssueID: opts.IssueID,
176+
CommentID: opts.CommentID,
176177
}
177178
findOpts := FindReactionsOptions{
178179
IssueID: opts.IssueID,
179-
CommentID: -1, // reaction to issue only
180+
CommentID: opts.CommentID, // reaction to issue only
180181
Reaction: opts.Type,
181182
UserID: opts.DoerID,
182183
}
183184

184-
reaction.CommentID = opts.CommentID
185-
findOpts.CommentID = opts.CommentID
186-
187185
existingR, _, err := FindReactions(ctx, findOpts)
188186
if err != nil {
189187
return nil, err

0 commit comments

Comments
 (0)