Commit 53d7eb7a authored by Ghada El-Zoghbi's avatar Ghada El-Zoghbi

Bug 1832308: Group setting and isolated institutions

The public setting on a group should not affect
the jointype.

Bring back original 18.10 functionality for
group settings page by:
* Removing the friends customisation.
* Removing affect of Public setting on other toggles.

Bring back original 18.10 functionality for who
can join a group:
* Users will be able to join the group on their own -
  if it is open - regardless of the isolatedinstitutions
  and public settings.

Please note for isolatedinstitutions:
Only site admins can create public groups.
It is up to the site admin to add users to groups
if they are set to public.
It is also up to the site admin to correctly set the jointype
for the group.
Therefore, for open groups, users can join the
group if it's in their institution.

Sponsored by The Australian National University

behatnotneeded

Change-Id: I0901f1ddf3b1c982dab0b3f4725755b6b0cdf5f2
parent 101db75b
......@@ -148,7 +148,7 @@ $elements['open'] = array(
'title' => get_string('Open', 'group'),
'description' => get_string('opendescription', 'group'),
'defaultvalue' => $group_data->open,
'disabled' => $group_data->controlled || $group_data->public,
'disabled' => !$cancreatecontrolled && $group_data->controlled,
);
if ($cancreatecontrolled || $group_data->controlled) {
$elements['controlled'] = array(
......@@ -207,22 +207,20 @@ else {
);
}
if (!get_config('friendsnotallowed')) {
$elements['invitefriends'] = array(
'type' => 'switchbox',
'title' => get_string('friendinvitations', 'group'),
'description' => get_string('invitefriendsdescription1', 'group'),
'defaultvalue' => $group_data->invitefriends,
);
$elements['invitefriends'] = array(
'type' => 'switchbox',
'title' => get_string('friendinvitations', 'group'),
'description' => get_string('invitefriendsdescription1', 'group'),
'defaultvalue' => $group_data->invitefriends,
);
$elements['suggestfriends'] = array(
'type' => 'switchbox',
'title' => get_string('Recommendations', 'group'),
'description' => get_string('suggestfriendsdescription1', 'group'),
'defaultvalue' => $group_data->suggestfriends && ($group_data->open || $group_data->request),
'disabled' => !$group_data->open && !$group_data->request,
);
}
$elements['suggestfriends'] = array(
'type' => 'switchbox',
'title' => get_string('Recommendations', 'group'),
'description' => get_string('suggestfriendsdescription1', 'group'),
'defaultvalue' => $group_data->suggestfriends && ($group_data->open || $group_data->request),
'disabled' => !$group_data->open && !$group_data->request,
);
$elements['pages'] = array(
'type' => 'html',
......@@ -609,22 +607,6 @@ jQuery(function($) {
}
}
});
$("#editgroup_public").on("click", function() {
if (this.checked) {
$("#editgroup_controlled").prop("checked", true);
$("#editgroup_request").prop("checked", true);
$("#editgroup_request").prop("disabled", false);
$("#editgroup_open").prop("checked", false);
$("#editgroup_open").prop("disabled", true);
}
else {
$("#editgroup_controlled").prop("checked", false);
$("#editgroup_request").prop("checked", false);
$("#editgroup_request").prop("disabled", true);
$("#editgroup_open").prop("checked", true);
$("#editgroup_open").prop("disabled", false);
}
});
$("#editgroup_request").on("click", function() {
if (this.checked) {
$("#editgroup_suggestfriends").prop("disabled", false);
......
......@@ -1714,8 +1714,11 @@ function group_prepare_usergroups_for_display($groups) {
else if ($group->membershiptype == 'invite') {
$group->invite = group_get_accept_form('invite' . $i++, $group->id);
}
// When 'isolatedinstitutions' is set, people cannot join public groups by themselves
else if ($group->jointype == 'open' && !(is_isolated() && $group->public == 1)) {
// Only admin can create public groups when isolatedinstitutions is set.
// It's up to the admin to correctly set the jointype. Public should not affect the open status.
// So for isolatedinstitutions and open groups, people can join that group if it's in their
// institution.
else if ($group->jointype == 'open') {
$group->groupjoin = group_get_join_form('joingroup' . $i++, $group->id);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment