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.
Passed
Push — master ( 061b69...390ccf )
by Jesus
04:42
created

room.js ➔ ResetAccessCode   A

Complexity

Conditions 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
1
// BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
2
//
3
// Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
4
//
5
// This program is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU Lesser General Public License as published by the Free Software
7
// Foundation; either version 3.0 of the License, or (at your option) any later
8
// version.
9
//
10
// BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
11
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12
// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
13
//
14
// You should have received a copy of the GNU Lesser General Public License along
15
// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
16
17
// Room specific js for copy button and email link.
18
$(document).on('turbolinks:load', function(){
19
  var controller = $("body").data('controller');
20
  var action = $("body").data('action');
21
22
  // Only run on room pages.
23
  if (controller == "rooms" && action == "show"){
24
    var copy = $('#copy');
25
26
    // Handle copy button.
27
    copy.on('click', function(){
28
      var inviteURL = $('#invite-url');
29
      inviteURL.select();
30
31
      var success = document.execCommand("copy");
32
      if (success) {
33
        inviteURL.blur();
34
        copy.addClass('btn-success');
35
        copy.html("<i class='fas fa-check'></i>" + I18n["copied"])
0 ignored issues
show
Bug introduced by
The variable I18n seems to be never declared. If this is a global, consider adding a /** global: I18n */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
36
        setTimeout(function(){
37
          copy.removeClass('btn-success');
38
          copy.html("<i class='fas fa-copy'></i>" + I18n["copy"])
0 ignored issues
show
Bug introduced by
The variable I18n seems to be never declared. If this is a global, consider adding a /** global: I18n */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
39
        }, 2000)
40
      }
41
    });
42
43
    // Forces the wrapper to take the entire screen height if the user can't create rooms
44
    if ($("#cant-create-room-wrapper").length){
45
      $(".wrapper").css('height', '100%').css('height', '-=130px');
46
    }
47
  }
48
49
  // Display and update all fields related to creating a room in the createRoomModal
50
  $("#create-room-block").click(function(){
51
    $("#create-room-name").val("")
52
    $("#create-room-access-code").text(I18n["modal"]["create_room"]["access_code_placeholder"])
0 ignored issues
show
Bug introduced by
The variable I18n seems to be never declared. If this is a global, consider adding a /** global: I18n */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
53
    $("#room_access_code").val(null)
54
55
    $("#createRoomModal form").attr("action", $("body").data('relative-root'))
56
    $("#room_mute_on_join").prop("checked", false)
57
    $("#room_require_moderator_approval").prop("checked", false)
58
    $("#room_anyone_can_start").prop("checked", false)
59
    $("#room_all_join_moderator").prop("checked", false)
60
61
    //show all elements & their children with a create-only class
62
    $(".create-only").each(function() {
63
      $(this).show()
64
      if($(this).children().length > 0) { $(this).children().show() }
65
    })
66
67
    //hide all elements & their children with a update-only class
68
    $(".update-only").each(function() {
69
      $(this).attr('style',"display:none !important")
70
      if($(this).children().length > 0) { $(this).children().attr('style',"display:none !important") }
71
    })
72
  })
73
74
  // Display and update all fields related to creating a room in the createRoomModal
75
  $(".update-room").click(function(){
76
    var room_block_uid = $(this).closest("#room-block").data("room-uid")
77
    $("#create-room-name").val($(this).closest("tbody").find("#room-name h4").text())
78
    $("#createRoomModal form").attr("action", room_block_uid + "/update_settings")
79
80
    //show all elements & their children with a update-only class
81
    $(".update-only").each(function() {
82
      $(this).show()
83
      if($(this).children().length > 0) { $(this).children().show() }
84
    })
85
86
    //hide all elements & their children with a create-only class
87
    $(".create-only").each(function() {
88
      $(this).attr('style',"display:none !important")
89
      if($(this).children().length > 0) { $(this).children().attr('style',"display:none !important") }
90
    })
91
92
    updateCurrentSettings($(this).closest("#room-block").data("room-settings"))
93
    
94
    accessCode = $(this).closest("#room-block").data("room-access-code")
0 ignored issues
show
Bug introduced by
The variable accessCode seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.accessCode.
Loading history...
95
96
    if(accessCode){
97
      $("#create-room-access-code").text(I18n["modal"]["create_room"]["access_code"] + ": " + accessCode)
0 ignored issues
show
Bug introduced by
The variable I18n seems to be never declared. If this is a global, consider adding a /** global: I18n */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
98
      $("#room_access_code").val(accessCode)
99
    } else{
100
      $("#create-room-access-code").text(I18n["modal"]["create_room"]["access_code_placeholder"])
101
      $("#room_access_code").val(null)
102
    }
103
  })
104
105
  //Update the createRoomModal to show the correct current settings
106
  function updateCurrentSettings(settings){
107
    //set checkbox
108
    if(settings.muteOnStart){
109
      $("#room_mute_on_join").prop("checked", true)
110
    } else { //default option
111
      $("#room_mute_on_join").prop("checked", false)
112
    }
113
114
    if(settings.requireModeratorApproval){
115
      $("#room_require_moderator_approval").prop("checked", true)
116
    } else { //default option
117
      $("#room_require_moderator_approval").prop("checked", false)
118
    }
119
    
120
    if(settings.anyoneCanStart){
121
      $("#room_anyone_can_start").prop("checked", true)
122
    } else { //default option
123
      $("#room_anyone_can_start").prop("checked", false)
124
    }
125
126
    if(settings.joinModerator){
127
      $("#room_all_join_moderator").prop("checked", true)
128
    } else { //default option
129
      $("#room_all_join_moderator").prop("checked", false)
130
    }
131
  }
132
});
133
134
function generateAccessCode(){
135
  const accessCodeLength = 6
136
  var validCharacters = "0123456789"
137
  var accessCode = ""
138
139
  for( var i = 0; i < accessCodeLength; i++){
140
    accessCode += validCharacters.charAt(Math.floor(Math.random() * validCharacters.length));
141
  }
142
143
  $("#create-room-access-code").text(I18n["modal"]["create_room"]["access_code"] + ": " + accessCode)
0 ignored issues
show
Bug introduced by
The variable I18n seems to be never declared. If this is a global, consider adding a /** global: I18n */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
144
  $("#room_access_code").val(accessCode)
145
}
146
147
function ResetAccessCode(){
148
  $("#create-room-access-code").text(I18n["modal"]["create_room"]["access_code_placeholder"])
0 ignored issues
show
Bug introduced by
The variable I18n seems to be never declared. If this is a global, consider adding a /** global: I18n */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
149
  $("#room_access_code").val(null)
150
}
151