mirror of https://github.com/tootsuite/mastodon
Use `distinct` and `count` to generate query in `ReactionValidator` limit check
parent
44d92fa4f6
commit
5dda61ff08
|
@ -23,6 +23,6 @@ class ReactionValidator < ActiveModel::Validator
|
|||
end
|
||||
|
||||
def limit_reached?(reaction)
|
||||
reaction.announcement.announcement_reactions.where.not(name: reaction.name).count('distinct name') >= LIMIT
|
||||
reaction.announcement.announcement_reactions.where.not(name: reaction.name).distinct.count(:name) >= LIMIT
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue