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 if verify_recaptcha
@screenshot.delete_reason = params[:delete_reason] @screenshot.delete_reason = params[:delete_reason]
@screenshot.markedfordelete = true @screenshot.markedfordelete = true
@screenshot.save! if @screenshot.valid?
flash['notice'] = "Screenshot reported. The moderators will deal with it." @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 end
redirect_to :back redirect_to :back
end end