Merge pull request #18403 from owncloud/do-not-delete-group-if-empty
Do not delete group if empty, hide delete icon for group admin
This commit is contained in:
commit
08161027c4
|
@ -60,9 +60,6 @@ if( OC_Group::inGroup( $username, $group )) {
|
||||||
$error = $l->t("Unable to remove user from group %s", $group);
|
$error = $l->t("Unable to remove user from group %s", $group);
|
||||||
$success = OC_Group::removeFromGroup( $username, $group );
|
$success = OC_Group::removeFromGroup( $username, $group );
|
||||||
$usersInGroup=OC_Group::usersInGroup($group);
|
$usersInGroup=OC_Group::usersInGroup($group);
|
||||||
if(count($usersInGroup) === 0) {
|
|
||||||
OC_Group::deleteGroup($group);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$success = OC_Group::addToGroup( $username, $group );
|
$success = OC_Group::addToGroup( $username, $group );
|
||||||
|
|
|
@ -470,17 +470,6 @@ var UserList = {
|
||||||
UserList.availableGroups.push(groupName);
|
UserList.availableGroups.push(groupName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// in case this was the last user in that group the group has to be removed
|
|
||||||
var groupElement = GroupList.getGroupLI(groupName);
|
|
||||||
var userCount = GroupList.getUserCount(groupElement);
|
|
||||||
if (response.data.action === 'remove' && userCount === 1) {
|
|
||||||
_.without(UserList.availableGroups, groupName);
|
|
||||||
GroupList.remove(groupName);
|
|
||||||
$('.groupsselect option').filterAttr('value', groupName).remove();
|
|
||||||
$('.subadminsselect option').filterAttr('value', groupName).remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (response.data.message) {
|
if (response.data.message) {
|
||||||
OC.Notification.show(response.data.message);
|
OC.Notification.show(response.data.message);
|
||||||
|
|
|
@ -43,9 +43,11 @@
|
||||||
</a>
|
</a>
|
||||||
<span class="utils">
|
<span class="utils">
|
||||||
<span class="usercount"><?php if($group['usercount'] > 0) { p($group['usercount']); } ?></span>
|
<span class="usercount"><?php if($group['usercount'] > 0) { p($group['usercount']); } ?></span>
|
||||||
|
<?php if($_['isAdmin']): ?>
|
||||||
<a href="#" class="action delete" original-title="<?php p($l->t('Delete'))?>">
|
<a href="#" class="action delete" original-title="<?php p($l->t('Delete'))?>">
|
||||||
<img src="<?php print_unescaped(image_path('core', 'actions/delete.svg')) ?>" class="svg" />
|
<img src="<?php print_unescaped(image_path('core', 'actions/delete.svg')) ?>" class="svg" />
|
||||||
</a>
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
Loading…
Reference in New Issue