Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix group restriction regression
Signed-off-by: Morris Jobke <[email protected]>
  • Loading branch information
MorrisJobke committed May 19, 2017
commit c7ade8598203c49fabeef16667282260b73a60a3
14 changes: 7 additions & 7 deletions settings/js/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,10 @@ OC.Settings.Apps = OC.Settings.Apps || {
page.find(".groups-enable").hide();
page.find(".groups-enable__checkbox").prop('checked', false);
} else {
page.find('#group_select').val((app.groups || []).join('|'));
page.find('.group_select').val((app.groups || []).join('|'));
if (app.active) {
if (app.groups.length) {
OC.Settings.Apps.setupGroupsSelect(page.find('#group_select'));
OC.Settings.Apps.setupGroupsSelect(page.find('.group_select'));
page.find(".groups-enable__checkbox").prop('checked', true);
} else {
page.find(".groups-enable__checkbox").prop('checked', false);
Expand Down Expand Up @@ -390,7 +390,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
elements.forEach(function(element) {
element.val(t('settings', 'Enable'));
element.parent().find(".groups-enable").hide();
element.parent().find('#group_select').hide().val(null);
element.parent().find('.group_select').hide().val(null);
});
OC.Settings.Apps.State.apps[appId].active = false;
}
Expand Down Expand Up @@ -458,7 +458,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
elements.forEach(function(element) {
element.parent().find(".groups-enable").prop('checked', true);
element.parent().find(".groups-enable").hide();
element.parent().find('#group_select').hide().val(null);
element.parent().find('.group_select').hide().val(null);
});
} else {
elements.forEach(function(element) {
Expand Down Expand Up @@ -905,8 +905,8 @@ OC.Settings.Apps = OC.Settings.Apps || {
OC.Settings.Apps.updateApp(appId, element);
});

$(document).on('change', '#group_select', function() {
var element = $(this).parent().find('input.enable');
$(document).on('change', '.group_select', function() {
var element = $(this).closest('.section').find('input.enable');
var groups = $(this).val();
if (groups && groups !== '') {
groups = groups.split('|');
Expand All @@ -922,7 +922,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
});

$(document).on('change', ".groups-enable__checkbox", function() {
var $select = $(this).closest('.section').find('#group_select');
var $select = $(this).closest('.section').find('.group_select');
$select.val('');

if (this.checked) {
Expand Down
4 changes: 2 additions & 2 deletions settings/templates/apps.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<div class="groups-enable">
<input type="checkbox" class="groups-enable__checkbox checkbox" id="groups_enable-{{id}}"/>
<label for="groups_enable-{{id}}"><?php p($l->t('Limit to groups')); ?></label>
<input type="hidden" id="group_select" title="<?php p($l->t('All')); ?>">
<input type="hidden" class="group_select" title="<?php p($l->t('All')); ?>">
</div>
{{/if}}
</div>
Expand Down Expand Up @@ -182,7 +182,7 @@
<input type="checkbox" class="groups-enable__checkbox checkbox" id="groups_enable-{{id}}"/>
<label for="groups_enable-{{id}}"><?php p($l->t('Enable only for specific groups')); ?></label>
</div>
<input type="hidden" id="group_select" title="<?php p($l->t('All')); ?>" style="width: 200px">
<input type="hidden" class="group_select" title="<?php p($l->t('All')); ?>" style="width: 200px">
{{else}}
<input class="enable{{#if needsDownload}} needs-download{{/if}}" type="submit" data-appid="{{id}}" data-active="false" {{#unless canInstall}}disabled="disabled"{{/unless}} value="<?php p($l->t("Enable"));?>"/>
{{/if}}
Expand Down