forked from External/greenlight
		
	join with specific id
This commit is contained in:
		@@ -77,9 +77,6 @@ class RoomsController < ApplicationController
 | 
			
		||||
    opts = default_meeting_options
 | 
			
		||||
    opts[:user_is_moderator] = true
 | 
			
		||||
 | 
			
		||||
    @room.sessions += 1
 | 
			
		||||
    @room.save
 | 
			
		||||
 | 
			
		||||
    redirect_to @room.join_path(current_user, opts)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,19 @@ class Room < ApplicationRecord
 | 
			
		||||
    bbb.is_meeting_running?(bbb_id)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  # Retrieves all the users in a room.
 | 
			
		||||
  def participants
 | 
			
		||||
    begin
 | 
			
		||||
      res = bbb.get_meeting_info(bbb_id, nil)
 | 
			
		||||
      res[:attendees].map do |att|
 | 
			
		||||
        User.find_by(uid: att[:userID], name: att[:fullName])
 | 
			
		||||
      end
 | 
			
		||||
    rescue BigBlueButton::BigBlueButtonException => exc
 | 
			
		||||
      # The meeting is most likely not running.
 | 
			
		||||
      []
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  # Determines the invite URL for the room.
 | 
			
		||||
  def invite_path
 | 
			
		||||
    "/r/#{uid}"
 | 
			
		||||
@@ -40,6 +53,10 @@ class Room < ApplicationRecord
 | 
			
		||||
      moderatorOnlyMessage: options[:moderator_message]
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # Increment room sessions.
 | 
			
		||||
    self.sessions += 1
 | 
			
		||||
    self.save
 | 
			
		||||
 | 
			
		||||
    #meeting_options.merge!(
 | 
			
		||||
      #{ "meta_room-id": options[:room_owner],
 | 
			
		||||
      #  "meta_meeting-name": options[:meeting_name]}
 | 
			
		||||
@@ -55,7 +72,7 @@ class Room < ApplicationRecord
 | 
			
		||||
 | 
			
		||||
  # Returns a URL to join a user into a meeting.
 | 
			
		||||
  def join_path(user, options = {})
 | 
			
		||||
    user = user.name if user.is_a?(User)
 | 
			
		||||
    username = user.name if user.is_a?(User)
 | 
			
		||||
 | 
			
		||||
    # Create the meeting if it isn't running.
 | 
			
		||||
    start_session(options) unless is_running?
 | 
			
		||||
@@ -83,7 +100,7 @@ class Room < ApplicationRecord
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # Generate the join URL.
 | 
			
		||||
    bbb.join_meeting_url(bbb_id, user, password)
 | 
			
		||||
    bbb.join_meeting_url(bbb_id, username, password, {userID: user.uid})
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  # Fetches all recordings for a meeting.
 | 
			
		||||
 
 | 
			
		||||
@@ -88,8 +88,9 @@ class User < ApplicationRecord
 | 
			
		||||
 | 
			
		||||
  private
 | 
			
		||||
 | 
			
		||||
  # Initializes a room for the user.
 | 
			
		||||
  # Initializes a room for the user and assign a BigBlueButton user id.
 | 
			
		||||
  def initialize_main_room
 | 
			
		||||
    self.uid =  "gl-#{(0...12).map { (65 + rand(26)).chr }.join.downcase}"
 | 
			
		||||
    self.main_room = Room.create!(owner: self, name: firstname + "'s Room")
 | 
			
		||||
    self.save
 | 
			
		||||
  end
 | 
			
		||||
 
 | 
			
		||||
@@ -34,3 +34,5 @@
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<%= @room.participants %>
 | 
			
		||||
 
 | 
			
		||||
@@ -24,6 +24,9 @@
 | 
			
		||||
              <%= button_to root_path, class: "dropdown-item" do %>
 | 
			
		||||
                <i class="dropdown-icon fe fe-link"></i> Copy Link
 | 
			
		||||
              <% end %>
 | 
			
		||||
              <%= button_to root_path, class: "dropdown-item" do %>
 | 
			
		||||
                <i class="dropdown-icon fas fa-cog"></i> Room Settings
 | 
			
		||||
              <% end %>
 | 
			
		||||
              <% if room != current_user.main_room %>
 | 
			
		||||
                <%= button_to make_home_path(room), class: "dropdown-item" do %>
 | 
			
		||||
                  <i class="dropdown-icon fas fa-home"></i> Make Home Room
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user