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
Pull Request — master (#709)
by
unknown
04:17
created

app/assets/javascripts/user_edit.js   A

Complexity

Total Complexity 8
Complexity/F 2

Size

Lines of Code 58
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 8
eloc 37
mnd 4
bc 4
fnc 4
dl 0
loc 58
rs 10
bpm 1
cpm 2
noi 0
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
B user_edit.js ➔ clearRole 0 19 8
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
$(document).on('turbolinks:load', function(){
18
    var controller = $("body").data('controller');
19
    var action = $("body").data('action');
20
    if ((controller == "admins" && action == "edit_user") || (controller == "users" && action == "edit")) {
21
        $(".setting-btn").click(function(data){
22
            var url = $("body").data("relative-root")
23
            if (!url.endsWith("/")) {
24
                url += "/"
25
            }
26
            url += "admins?setting=" + data.target.id
27
28
            window.location.href = url
29
        })
30
31
        $(".clear-role").click(clearRole)
32
33
        $("#role-select-dropdown").change(function(data){
34
            var dropdown = $("#role-select-dropdown");
35
            var select_role_id = dropdown.val();
36
37
            if(select_role_id){
38
                var selected_role = dropdown.find('[value=\"' + select_role_id + '\"]');
39
                selected_role.prop("disabled", true)
40
41
                var tag_container = $("#role-tag-container");
42
                tag_container.append("<span id=\"user-role-tag_" + select_role_id + "\" style=\"background-color:" + selected_role.data("colour") + ";\" class=\"tag\">" + 
43
                    selected_role.text() + "<a data-role-id=\"" + select_role_id + "\" class=\"tag-addon clear-role\"><i data-role-id=\"" + select_role_id + "\" class=\"fas fa-times\"></i></a></span>");
44
45
                var role_ids = $("#user_role_ids").val()
46
                role_ids += " " + select_role_id
47
                $("#user_role_ids").val(role_ids)
48
                
49
                $("#user-role-tag_" + select_role_id).click(clearRole);
50
                dropdown.val(null)
51
            }
52
        })
53
    }
54
})
55
56
function clearRole(data){
57
    var role_id = $(data.target).data("role-id");
58
    var role_tag = $("#user-role-tag_" + role_id);
59
    $(role_tag).remove()
60
  
61
    var role_ids = $("#user_role_ids").val()
62
    var parsed_ids = role_ids.split(' ')
63
  
64
    var index = parsed_ids.indexOf(role_id.toString());
65
  
66
    if (index > -1) {
67
        parsed_ids.splice(index, 1);
68
    }
69
  
70
    $("#user_role_ids").val(parsed_ids.join(' '))
71
  
72
    var selected_role = $("#role-select-dropdown").find('[value=\"' + role_id + '\"]');
73
    selected_role.prop("disabled", false)
74
}