work on user settings

This commit is contained in:
Josh
2018-06-04 15:58:59 -04:00
parent 79949b4aa6
commit d9a95ffc18
22 changed files with 266 additions and 232 deletions

View File

@ -1,3 +1,7 @@
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
def to_param
uid
end
end

View File

@ -10,10 +10,6 @@ class Room < ApplicationRecord
ROOM_ICONS = %w(circle star certificate play cloud heart square bookmark cog)
RETURNCODE_SUCCESS = "SUCCESS"
def to_param
uid
end
# Determines if a user owns a room.
def owned_by?(user)
return false if user.nil?
@ -72,8 +68,6 @@ class Room < ApplicationRecord
# Returns a URL to join a user into a meeting.
def join_path(user, options = {})
username = user.name if user.is_a?(User)
# Create the meeting if it isn't running.
start_session(options) unless is_running?
@ -100,7 +94,11 @@ class Room < ApplicationRecord
end
# Generate the join URL.
bbb.join_meeting_url(bbb_id, username, password, {userID: user.uid})
if user.is_a?(User)
bbb.join_meeting_url(bbb_id, user.name, password, {userID: user.uid})
else
bbb.join_meeting_url(bbb_id, user, password)
end
end
# Fetches all recordings for a meeting.

View File

@ -22,7 +22,11 @@ class User < ApplicationRecord
# Generates a user from omniauth.
def from_omniauth(auth)
user = find_or_initialize_by(uid: auth['uid'], provider: auth['provider'])
user = find_or_initialize_by(
social_uid: auth['uid'],
provider: auth['provider']
)
user.name = send("#{auth['provider']}_name", auth)
user.username = send("#{auth['provider']}_username", auth)
user.email = send("#{auth['provider']}_email", auth)