Merge pull request #5721 from FinnStutzenstein/fixGroupDeletionInConfig
Fix group deletion for config variables
This commit is contained in:
commit
b611642ecb
@ -159,9 +159,13 @@ export class HttpService {
|
|||||||
} else {
|
} else {
|
||||||
const errorList = Object.keys(e.error).map(key => {
|
const errorList = Object.keys(e.error).map(key => {
|
||||||
const capitalizedKey = key.charAt(0).toUpperCase() + key.slice(1);
|
const capitalizedKey = key.charAt(0).toUpperCase() + key.slice(1);
|
||||||
return `${this.translate.instant(capitalizedKey)}: ${this.processErrorDetailResponse(
|
let detail = e.error[key];
|
||||||
e.error[key]
|
if (detail instanceof Array) {
|
||||||
)}`;
|
detail = detail.join(' ');
|
||||||
|
} else {
|
||||||
|
detail = this.processErrorDetailResponse(detail);
|
||||||
|
}
|
||||||
|
return `${this.translate.instant(capitalizedKey)}: ${detail}`;
|
||||||
});
|
});
|
||||||
error = errorList.join(', ');
|
error = errorList.join(', ');
|
||||||
}
|
}
|
||||||
|
@ -346,7 +346,7 @@ export class AssignmentDetailComponent extends BaseViewComponentDirective implem
|
|||||||
...this.assignmentPollService.getDefaultPollData(this.assignment.id)
|
...this.assignmentPollService.getDefaultPollData(this.assignment.id)
|
||||||
};
|
};
|
||||||
|
|
||||||
this.pollDialog.openDialog(dialogData);
|
this.pollDialog.openDialog(dialogData).catch(this.raiseError);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -256,6 +256,16 @@ class ConfigHandler:
|
|||||||
"""
|
"""
|
||||||
return ConfigStore.get_collection_string()
|
return ConfigStore.get_collection_string()
|
||||||
|
|
||||||
|
def remove_group_id_from_all_group_configs(self, id: int) -> None:
|
||||||
|
for config_variable in self.config_variables.values():
|
||||||
|
if config_variable.input_type == "groups":
|
||||||
|
value = self[config_variable.name]
|
||||||
|
if isinstance(value, list) and id in value:
|
||||||
|
value = [x for x in value if x != id]
|
||||||
|
db_value = ConfigStore.objects.get(key=config_variable.name)
|
||||||
|
db_value.value = value
|
||||||
|
db_value.save()
|
||||||
|
|
||||||
|
|
||||||
config = ConfigHandler()
|
config = ConfigHandler()
|
||||||
"""
|
"""
|
||||||
|
@ -657,6 +657,7 @@ class GroupViewSet(ModelViewSet):
|
|||||||
|
|
||||||
# Delete the group
|
# Delete the group
|
||||||
self.perform_destroy(instance)
|
self.perform_destroy(instance)
|
||||||
|
config.remove_group_id_from_all_group_configs(instance.id)
|
||||||
|
|
||||||
# Get the updated user data from the DB.
|
# Get the updated user data from the DB.
|
||||||
affected_users = User.objects.filter(pk__in=affected_users_ids)
|
affected_users = User.objects.filter(pk__in=affected_users_ids)
|
||||||
|
Loading…
Reference in New Issue
Block a user