Completed
Branch more-refac (e20586)
by Ahmad
04:03
created

Joiner.default_meeting_options()   A

Complexity

Conditions 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
dl 0
loc 11
rs 9.85
c 1
b 0
f 0
1
# frozen_string_literal: true
2
3
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
4
#
5
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
6
#
7
# This program is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU Lesser General Public License as published by the Free Software
9
# Foundation; either version 3.0 of the License, or (at your option) any later
10
# version.
11
#
12
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
15
#
16
# You should have received a copy of the GNU Lesser General Public License along
17
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
18
19
module Joiner
20
  extend ActiveSupport::Concern
21
22
  def join_room(opts)
23
    room_settings = JSON.parse(@room[:room_settings])
24
25
    if room_running?(@room.bbb_id) || @room.owned_by?(current_user) || room_settings["anyoneCanStart"]
26
27
      # Determine if the user needs to join as a moderator.
28
      opts[:user_is_moderator] = @room.owned_by?(current_user) || room_settings["joinModerator"]
29
30
      opts[:require_moderator_approval] = room_settings["requireModeratorApproval"]
31
32
      if current_user
33
        redirect_to join_path(@room, current_user.name, opts, current_user.uid)
34
      else
35
        join_name = params[:join_name] || params[@room.invite_path][:join_name]
36
        redirect_to join_path(@room, join_name, opts)
37
      end
38
    else
39
      search_params = params[@room.invite_path] || params
40
      @search, @order_column, @order_direction, pub_recs =
41
        public_recordings(@room.bbb_id, search_params.permit(:search, :column, :direction), true)
42
43
      @pagy, @public_recordings = pagy_array(pub_recs)
44
45
      # They need to wait until the meeting begins.
46
      render :wait
47
    end
48
  end
49
50
  # Default, unconfigured meeting options.
51
  def default_meeting_options
52
    invite_msg = I18n.t("invite_message")
53
    {
54
      user_is_moderator: false,
55
      meeting_logout_url: request.base_url + logout_room_path(@room),
56
      meeting_recorded: true,
57
      moderator_message: "#{invite_msg}\n\n#{request.base_url + room_path(@room)}",
58
      host: request.host,
59
      recording_default_visibility: @settings.get_value("Default Recording Visibility") == "public"
60
    }
61
  end
62
end
63