Interviews: editing one silently drops a contact who has since moved company or been merged elsewhere #443
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo#443
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found on 2026-09-29 in a read-only review of postulo at
95348908d, comparing the interview form with the application form and checking the result with a unit test against the snapshot.Checked again on 2026-10-01 against
mainat0a5cad587: still present. The code is now atapplications/views.py:977-987(InterviewUpdateView.form_valid);applications/forms.pyhas not moved, and the same unit test gives the same result.The interview form offers as contacts only the people currently recorded at the application's company. A contact already linked to the interview who is no longer there has no checkbox on the edit page, so any save of the form, for a new room or a moved hour, removes them from who you are meeting without a word. #239 fixed exactly this for an application's main contact; the interview form was left out.
applications/forms.py:571-576(InterviewForm.scope_querysets); saved byapplications/views.py:937-947(InterviewUpdateView.form_valid,form.save()). Compareapplications/forms.py:377-385(ApplicationForm.scope_querysets), which keepsQ(pk=self.instance.contact_id).scope_querysetssets the queryset toContact.objects.for_user(self.user).filter(company=self.application.posting.company_id)with no clause for the contacts already on the instance.CheckboxSelectMultiplerenders only that queryset, so the browser posts nothing for the moved contact, andform.save()writes the many-to-many without them. Posting their id by hand is refused as "Select a valid choice". Checked: an interview scheduled with a contact at the employer, the contact then moved to another company, and an edit posted with a new location: the response was a redirect andinterview.contacts.all()was empty. The edit page did not show the contact at all.applications/ical.py), and it disappears from an unrelated edit with nothing to say it did. Contacts do move company, and merging duplicate contacts (#239) moves them too.InterviewForm.scope_querysets, whenself.instance.pkis set, widen the filter toQ(company=self.application.posting.company_id) | Q(pk__in=self.instance.contacts.values("pk")), still insideContact.objects.for_user(self.user), and say beside such a contact where they are now so the person can untick them knowingly. Adjust thecontactshelp text, which says only people at this company are offered.Done when
tests/test_interviews.pyhas a test mirroring the #239 one for the application form: schedule an interview with a contact, move the contact to another company, post an edit that changes only the location, and assert the contact is still linked.