mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 09:10:25 +08:00
Move the unique post key storage code into the Post model
This commit is contained in:
parent
48ee89940e
commit
78c15d5810
4 changed files with 14 additions and 6 deletions
|
@ -64,7 +64,7 @@ class Validators::PostValidator < ActiveModel::Validator
|
|||
# If the post is empty, default to the validates_presence_of
|
||||
return if post.raw.blank?
|
||||
|
||||
if $redis.exists(post.unique_post_key)
|
||||
if post.matches_recent_post?
|
||||
post.errors.add(:raw, I18n.t(:just_posted_that))
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue