fix(projects): edit-page responsible picker shows only active users (keeps current assignee)
Mirror the create-modal fix on ProjectDetail: filter the 'Zodpovědná osoba' select to active users (already scoped to projects.view), but keep the project's currently-assigned user selectable even if inactive, labelled '(neaktivní)', so the saved value still shows. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -81,10 +81,18 @@ export default function ProjectDetail() {
|
|||||||
const notes: ProjectNote[] = project?.project_notes || [];
|
const notes: ProjectNote[] = project?.project_notes || [];
|
||||||
|
|
||||||
const { data: usersData } = useQuery(userListOptions("projects.view"));
|
const { data: usersData } = useQuery(userListOptions("projects.view"));
|
||||||
const users: User[] = (usersData ?? []).map((u: ApiUser) => ({
|
// Only active users with projects.view — but keep the project's CURRENT
|
||||||
id: u.id,
|
// assignee in the list even if they're now inactive, so the select still
|
||||||
name: `${u.first_name || ""} ${u.last_name || ""}`.trim() || u.username,
|
// reflects the saved value (marked "(neaktivní)" so it's clear).
|
||||||
}));
|
const assignedUserId = project?.responsible_user_id || "";
|
||||||
|
const users: User[] = (usersData ?? [])
|
||||||
|
.filter((u: ApiUser) => u.is_active || String(u.id) === assignedUserId)
|
||||||
|
.map((u: ApiUser) => ({
|
||||||
|
id: u.id,
|
||||||
|
name:
|
||||||
|
(`${u.first_name || ""} ${u.last_name || ""}`.trim() || u.username) +
|
||||||
|
(u.is_active ? "" : " (neaktivní)"),
|
||||||
|
}));
|
||||||
|
|
||||||
// Reset form sync when navigating to a different project
|
// Reset form sync when navigating to a different project
|
||||||
const formInitialized = useRef(false);
|
const formInitialized = useRef(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user