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

RoomsHelper.room_limit_exceeded()   A

Complexity

Conditions 3

Size

Total Lines 9

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
cc 3
dl 9
loc 9
rs 9.95
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
module RoomsHelper
20
  # Helper to generate the path to a Google Calendar event creation
21
  # It will have its title set as the room name, and the location as the URL to the room
22
  def google_calendar_path
23
    "http://calendar.google.com/calendar/r/eventedit?text=#{@room.name}&location=#{request.base_url + request.fullpath}"
24
  end
25
26
  def room_authentication_required
27
    @settings.get_value("Room Authentication") == "true" &&
28
      current_user.nil?
29
  end
30
31
  def current_room_exceeds_limit(room)
32
    # Get how many rooms need to be deleted to reach allowed room number
33
    limit = @settings.get_value("Room Limit").to_i
34
35
    return false if current_user&.has_role?(:admin) || limit == 15
36
37
    @diff = current_user.rooms.count - limit
38
    @diff.positive? && current_user.rooms.pluck(:id).index(room.id) + 1 > limit
39
  end
40
end
41