Refactored auto-approve code to make it more readable

This commit is contained in:
Christoph Haas 2018-08-17 17:07:42 +02:00
parent 9428d8d7dd
commit 228b7375e7
2 changed files with 17 additions and 3 deletions

View file

@ -56,9 +56,8 @@ class PackagesController < ApplicationController
new_screenshot.version = @package.version
new_screenshot.user = current_user
# Package is not approved by default. Approve automatically
# for authenticated users.
new_screenshot.approve! if current_user and not current_user.is_anonymous?
# Can the upload get approved automatically?
new_screenshot.approve! if current_user and current_user.auto_approve?
new_screenshot.save
Log.log "Screenshot #{new_screenshot.id} uploaded successfully from #{session[:ip]}. User has token #{session[:token]} or is #{current_user}"