mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +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]
|
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 ||
|
if site.profile_comments_enabled == false ||
|
||||||
params[:message].empty? ||
|
params[:message].empty? ||
|
||||||
site.is_blocking?(current_site) ||
|
site.is_blocking?(current_site) ||
|
||||||
|
|
Loading…
Add table
Reference in a new issue