diff --git a/backend/job/job_post/views.py b/backend/job/job_post/views.py index 8ead2e3..6a378ff 100644 --- a/backend/job/job_post/views.py +++ b/backend/job/job_post/views.py @@ -49,9 +49,15 @@ MAX_JOB_IMAGE_BYTES=5*1024*1024 def _payload_recruiter_ids(payload): - if payload.get("current_recruiter_ids"): - raw=payload.get("current_recruiter_ids") - return raw + """None = the client did not send recruiters, so leave them alone. + [] = the client sent an empty list, so remove every recruiter. + + Checks for the key rather than truthiness: an empty list is falsy, and + reading it as "not sent" made the last recruiter impossible to remove. + """ + if "current_recruiter_ids" not in payload: + return None + return payload.get("current_recruiter_ids") or [] def _recruiter_fields(users): ids=[str(u.id) for u in users]