Validation for screenshot reporting form fixed

This commit is contained in:
Christoph Haas 2016-07-21 18:38:44 +02:00
parent 94377cdc28
commit b57ed7ce1b

View file

@ -180,8 +180,13 @@ class PackagesController < ApplicationController
if verify_recaptcha
@screenshot.delete_reason = params[:delete_reason]
@screenshot.markedfordelete = true
@screenshot.save!
flash['notice'] = "Screenshot reported. The moderators will deal with it."
if @screenshot.valid?
@screenshot.save!
flash['notice'] = "Screenshot reported. The moderators will deal with it."
else
errors = @screenshot.errors.to_a.join(' and ')
flash['alert'] = "Sorry. #{errors}"
end
end
redirect_to :back
end