Screenshot upload process fixed and tested

This commit is contained in:
Christoph Haas 2018-08-17 09:21:32 +02:00
parent 125e9c8ee5
commit 9428d8d7dd
5 changed files with 60 additions and 3 deletions

View file

@ -91,7 +91,7 @@ class Screenshot < ApplicationRecord
end
# Publish a screenshot from the moderation queue
def approve_screenshot!
def approve!
self.delete_reason = nil
self.markedfordelete = false
self.approved = true

View file

@ -43,6 +43,13 @@ class User < ApplicationRecord
self.admin == 1
end
# Check if a user has been created on-the-fly and is just an
# anonymous user who uploaded a screenshot. They can turn this
# user record into a registered account though.
def is_anonymous?
self.provider == nil
end
def self.from_omniauth(auth)
where(provider: auth.provider, email: auth.info.email).first_or_create do |user|
user.provider = auth.provider