Skip to content

Commit

Permalink
improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Mar 31, 2022
1 parent 19ca47a commit d034190
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions models/issues/reaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,18 @@ func FindReactions(ctx context.Context, opts FindReactionsOptions) (ReactionList

func createReaction(ctx context.Context, opts *ReactionOptions) (*Reaction, error) {
reaction := &Reaction{
Type: opts.Type,
UserID: opts.DoerID,
IssueID: opts.IssueID,
Type: opts.Type,
UserID: opts.DoerID,
IssueID: opts.IssueID,
CommentID: opts.CommentID,
}
findOpts := FindReactionsOptions{
IssueID: opts.IssueID,
CommentID: -1, // reaction to issue only
CommentID: opts.CommentID, // reaction to issue only
Reaction: opts.Type,
UserID: opts.DoerID,
}

reaction.CommentID = opts.CommentID
findOpts.CommentID = opts.CommentID

existingR, _, err := FindReactions(ctx, findOpts)
if err != nil {
return nil, err
Expand Down

0 comments on commit d034190

Please sign in to comment.