diff --git a/app/site.rb b/app/site.rb index e007bb87..4f019533 100644 --- a/app/site.rb +++ b/app/site.rb @@ -115,6 +115,11 @@ post '/site/:username/report' do |username| redirect request.referer if site.nil? + if !recaptcha_valid? + flash[:error] = 'Captcha was not filled out (or was filled out incorrectly)' + redirect request.referer + end + report = Report.new site_id: site.id, type: params[:type], comments: params[:comments] if current_site @@ -133,6 +138,8 @@ post '/site/:username/report' do |username| body: "Reported by #{report.reporting_site_id ? report.reporting_site.username : report.ip}: #{report.comments}" }) + flash[:success] = "Thank you for the report, we will look into it." + redirect request.referer end diff --git a/views/site.erb b/views/site.erb index ec880b25..f59d00dd 100644 --- a/views/site.erb +++ b/views/site.erb @@ -35,13 +35,13 @@ <% if current_site && current_site != site %> <% is_following = current_site.is_following?(site) %> - + Unfollow Following Follow - + <% end %> @@ -60,8 +60,8 @@
- \ No newline at end of file +
To prevent spam, you cannot comment until you have updated your site <%= Site::COMMENTING_ALLOWED_UPDATED_COUNT %> times (on <%= Site::COMMENTING_ALLOWED_UPDATED_COUNT %> separate days), and your account is one week old. While waiting, now is a great time to start building your awesome site! @@ -117,11 +117,14 @@ <% if site != current_site %>
Comments:
+Please describe the problem:
+ +Please fill out the captcha so we know you're not a robot:
+