Skip to content

Commit

Permalink
fix: modify savePermissions to move users between followers and col…
Browse files Browse the repository at this point in the history
…laborators lists
  • Loading branch information
annehaley committed Oct 10, 2024
1 parent 16e6140 commit 1c83360
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions web/src/components/AccessControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function savePermissions() {
collaborators.delete(userToRemove.value.id);
followers.delete(userToRemove.value.id);
} else if (
["transfer", "claim"].includes(userSelectDialogMode.value) &&
userSelectDialogMode.value === "transfer" &&
selectedUsers.value.length === 1
) {
// Transfer ownership to new owner, demoting current owner to collaborator
Expand All @@ -39,20 +39,24 @@ function savePermissions() {
owner = newOwner;
} else if (selectedPermissionLevel.value == "collaborator") {
selectedUsers.value.forEach((u: User) => collaborators.add(u.id));
selectedUsers.value.forEach((u: User) => followers.delete(u.id));
} else if (selectedPermissionLevel.value == "follower") {
selectedUsers.value.forEach((u: User) => followers.add(u.id));
selectedUsers.value.forEach((u: User) => collaborators.delete(u.id));
}
const newPermissions: ProjectPermissions = {
owner_id: owner,
collaborator_ids: Array.from(collaborators),
follower_ids: Array.from(followers),
};
updateProjectPermissions(props.project.id, newPermissions).then((project) => {
emit("updateSelectedProject", project);
selectedUsers.value = [];
selectedPermissionLevel.value = "follower";
showUserSelectDialog.value = false;
userToRemove.value = undefined;
if (project) {
emit("updateSelectedProject", project);
selectedUsers.value = [];
selectedPermissionLevel.value = "follower";
showUserSelectDialog.value = false;
userToRemove.value = undefined;
}
});
}
Expand Down

0 comments on commit 1c83360

Please sign in to comment.