GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — v2.4-alpha ( 96ace3...b4736b )
by Ahmad
11:22 queued 05:48
created

Room.notify_waiting()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 3
rs 10
c 0
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
require 'bbb_api'
20
21
class Room < ApplicationRecord
22
  before_create :setup
23
24
  validates :name, presence: true
25
26
  belongs_to :owner, class_name: 'User', foreign_key: :user_id
27
28
  # Determines if a user owns a room.
29
  def owned_by?(user)
30
    return false if user.nil?
31
    user.rooms.include?(self)
32
  end
33
34
  # Determines the invite path for the room.
35
  def invite_path
36
    "#{Rails.configuration.relative_url_root}/#{CGI.escape(uid)}"
37
  end
38
39
  # Notify waiting users that a meeting has started.
40
  def notify_waiting
41
    ActionCable.server.broadcast("#{uid}_waiting_channel", action: "started")
42
  end
43
44
  private
45
46
  # Generates a uid for the room and BigBlueButton.
47
  def setup
48
    self.uid = random_room_uid
49
    self.bbb_id = Digest::SHA1.hexdigest(Rails.application.secrets[:secret_key_base] + Time.now.to_i.to_s).to_s
50
    self.moderator_pw = RandomPassword.generate(length: 12)
51
    self.attendee_pw = RandomPassword.generate(length: 12)
52
  end
53
54
  # Generates a three character uid chunk.
55
  def uid_chunk
56
    charset = ("a".."z").to_a - %w(b i l o s) + ("2".."9").to_a - %w(5 8)
57
    (0...3).map { charset.to_a[rand(charset.size)] }.join
58
  end
59
60
  # Generates a random room uid that uses the users name.
61
  def random_room_uid
62
    [owner.name_chunk, uid_chunk, uid_chunk].join('-').downcase
63
  end
64
end
65