Skip to content

Commit

Permalink
fix migrator add/delete reaction
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Jan 15, 2020
1 parent e2f7527 commit 33495ce
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions models/issue_reaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ func (opts *FindReactionsOptions) toConds() builder.Cond {
cond = cond.And(builder.Eq{"reaction.comment_id": 0})
}
if opts.UserID > 0 {
cond = cond.And(builder.Eq{"reaction.user_id": opts.UserID})
cond = cond.And(builder.Eq{
"reaction.user_id": opts.UserID,
"reaction.original_author_id": 0,
})
}
if opts.Reaction != "" {
cond = cond.And(builder.Eq{"reaction.type": opts.Reaction})
Expand Down Expand Up @@ -175,7 +178,7 @@ func deleteReaction(e *xorm.Session, opts *ReactionOptions) error {
if opts.Comment != nil {
reaction.CommentID = opts.Comment.ID
}
_, err := e.Delete(reaction)
_, err := e.Where("original_author_id = 0").Delete(reaction)
return err
}

Expand Down

0 comments on commit 33495ce

Please sign in to comment.