mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
prevent duplicate comments
This commit is contained in:
parent
48884994e1
commit
13e67fc264
1 changed files with 6 additions and 0 deletions
|
@ -129,6 +129,12 @@ post '/site/:username/comment' do |username|
|
|||
|
||||
site = Site[username: username]
|
||||
|
||||
last_comment = site.profile_comments_dataset.order(:created_at.desc).first
|
||||
|
||||
if last_comment && last_comment.message == params[:message] && last_comment.created_at > 2.hours.ago
|
||||
redirect request.referer
|
||||
end
|
||||
|
||||
if site.profile_comments_enabled == false ||
|
||||
params[:message].empty? ||
|
||||
site.is_blocking?(current_site) ||
|
||||
|
|
Loading…
Add table
Reference in a new issue