forked from External/greenlight
Merge branch 'v2'
This commit is contained in:
@ -22,8 +22,4 @@ class ApplicationRecord < ActiveRecord::Base
|
||||
def to_param
|
||||
uid
|
||||
end
|
||||
|
||||
def readonly?
|
||||
ENV["MAINTENANCE_MODE"] == "readonly"
|
||||
end
|
||||
end
|
||||
|
@ -70,7 +70,7 @@ class Room < ApplicationRecord
|
||||
# Update session info.
|
||||
unless meeting[:messageKey] == 'duplicateWarning'
|
||||
update_attributes(sessions: sessions + 1,
|
||||
last_session: DateTime.now) unless ENV["MAINTENANCE_MODE"] == "readonly"
|
||||
last_session: DateTime.now)
|
||||
end
|
||||
rescue BigBlueButton::BigBlueButtonException => e
|
||||
puts "BigBlueButton failed on create: #{e.key}: #{e.message}"
|
||||
|
@ -54,31 +54,14 @@ class User < ApplicationRecord
|
||||
def from_omniauth(auth)
|
||||
# Provider is the customer name if in loadbalanced config mode
|
||||
provider = auth['provider'] == "bn_launcher" ? auth['info']['customer'] : auth['provider']
|
||||
u = find_by(social_uid: auth['uid'], provider: provider)
|
||||
|
||||
if ENV["MAINTENANCE_MODE"] == "readonly"
|
||||
raise ActiveRecord::ReadOnlyRecord if u.nil?
|
||||
|
||||
return u
|
||||
find_or_initialize_by(social_uid: auth['uid'], provider: provider).tap do |u|
|
||||
u.name = auth_name(auth) unless u.name
|
||||
u.username = auth_username(auth) unless u.username
|
||||
u.email = auth_email(auth)
|
||||
u.image = auth_image(auth)
|
||||
u.email_verified = true
|
||||
u.save!
|
||||
end
|
||||
|
||||
return User.create(
|
||||
name: auth_name(auth),
|
||||
username: auth_username(auth),
|
||||
email: auth_email(auth),
|
||||
social_uid: auth['uid'],
|
||||
provider: provider,
|
||||
image: auth_image(auth),
|
||||
email_verified: true
|
||||
) if u.nil?
|
||||
|
||||
u.name = auth_name(auth) unless u.name
|
||||
u.username = auth_username(auth) unless u.username
|
||||
u.email = auth_email(auth)
|
||||
u.image = auth_image(auth) unless u.image
|
||||
u.email_verified = true
|
||||
u.save!
|
||||
u
|
||||
end
|
||||
|
||||
private
|
||||
|
Reference in New Issue
Block a user