fix: differentiate Conex (linkedEntryIds) vs Inchide (threadParentId) semantics
- Conex button now adds to linkedEntryIds (for clarificari/solicitari) instead of setting threadParentId - Inchide button sets threadParentId (direct reply) + auto-closes parent - Fix Sterge button persistence bug: threadParentId now saves as empty string instead of undefined (which was stripped in JSON serialization) - Card headers: "Conex cu X" (amber) vs "Raspuns la X" (blue + green) - Add conexTo prop to RegistryEntryForm for linked entry pre-fill Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -87,8 +87,10 @@ import { getDeadlineType } from "../services/deadline-catalog";
|
||||
|
||||
interface RegistryEntryFormProps {
|
||||
initial?: RegistryEntry;
|
||||
/** Pre-fill as reply (conex) to this entry — sets threadParentId, flips direction */
|
||||
/** Pre-fill as reply to this entry — sets threadParentId, flips direction (used by "Inchide") */
|
||||
replyTo?: RegistryEntry;
|
||||
/** Pre-fill as related/conex entry — adds to linkedEntryIds, keeps direction (used by "Conex") */
|
||||
conexTo?: RegistryEntry;
|
||||
allEntries?: RegistryEntry[];
|
||||
onSubmit: (
|
||||
data: Omit<RegistryEntry, "id" | "number" | "createdAt" | "updatedAt">,
|
||||
@@ -109,6 +111,7 @@ interface RegistryEntryFormProps {
|
||||
export function RegistryEntryForm({
|
||||
initial,
|
||||
replyTo,
|
||||
conexTo,
|
||||
allEntries,
|
||||
onSubmit,
|
||||
onCancel,
|
||||
@@ -193,7 +196,7 @@ export function RegistryEntryForm({
|
||||
);
|
||||
const [notes, setNotes] = useState(initial?.notes ?? "");
|
||||
const [linkedEntryIds, setLinkedEntryIds] = useState<string[]>(
|
||||
initial?.linkedEntryIds ?? [],
|
||||
initial?.linkedEntryIds ?? (conexTo ? [conexTo.id] : []),
|
||||
);
|
||||
const [attachments, setAttachments] = useState<RegistryAttachment[]>(
|
||||
initial?.attachments ?? [],
|
||||
@@ -557,7 +560,7 @@ export function RegistryEntryForm({
|
||||
deadline: deadline || undefined,
|
||||
assignee: assignee || undefined,
|
||||
assigneeContactId: assigneeContactId || undefined,
|
||||
threadParentId: threadParentId || undefined,
|
||||
threadParentId: threadParentId || "",
|
||||
recipientRegNumber: recipientRegNumber || undefined,
|
||||
recipientRegDate: recipientRegDate || undefined,
|
||||
expiryDate: expiryDate || undefined,
|
||||
|
||||
Reference in New Issue
Block a user