- group editor management bugs fixed

This commit is contained in:
Wiesner András 2024-09-25 23:00:03 +02:00
parent 550d60f71f
commit 21825c6f18
2 changed files with 9 additions and 1 deletions

View File

@ -538,6 +538,7 @@ function create_update_group(ReqHandler &$rh, array $params): string
{ {
global $user; global $user;
global $groupMgr; global $groupMgr;
global $userMgr;
$update = $params[ReqHandler::ACTION_KEY] === "update_group"; $update = $params[ReqHandler::ACTION_KEY] === "update_group";
$groupname = trim($params["groupname"]); $groupname = trim($params["groupname"]);
@ -557,7 +558,11 @@ function create_update_group(ReqHandler &$rh, array $params): string
$group->disableAutoStoring(); $group->disableAutoStoring();
$group->setName($groupname); $group->setName($groupname);
$group->setDescription($description); $group->setDescription($description);
$group->setOwner($owner);
// only an existing user might be an owner of a group
if ($userMgr->getUser($owner) !== null) {
$group->setOwner($owner);
}
$editors = array_intersect($editors, $group->getMembers()); // a user cannot be an editor if not participant of the group $editors = array_intersect($editors, $group->getMembers()); // a user cannot be an editor if not participant of the group
$group->setEditors($editors); $group->setEditors($editors);

View File

@ -76,6 +76,7 @@ function create_edit_group(group = null) {
}; };
if (update) { if (update) {
req["id"] = group["_id"]; req["id"] = group["_id"];
req["owner"] = group_ownerF.value
} }
request(req).then(resp => { request(req).then(resp => {
list_all_groups(); list_all_groups();
@ -163,5 +164,7 @@ function change_group_members() {
request(req).then(resp => { request(req).then(resp => {
userListTA.value = ""; userListTA.value = "";
hide("member_manager_window"); hide("member_manager_window");
hide("group_editor_window");
list_all_groups();
}); });
} }