[FIX] RECRUITMENT: #787

This commit is contained in:
Horilla
2025-06-30 16:35:12 +05:30
parent 0da929ff0c
commit ecef5aeb26

View File

@@ -154,9 +154,10 @@ def post_recruitment_in_linkedin(
@login_required @login_required
def delete_post(recruitment): def delete_post(recruitment):
"""Delete recruitment post from linkedin""" """Delete recruitment post from LinkedIn"""
# Ensure you are using the correct post ID from when you created the post linkedin_post_id = recruitment.linkedin_post_id
linkedin_post_id = recruitment.linkedin_post_id # e.g., "urn:li:ugcPost:123456789" if not linkedin_post_id:
return True # 787
url = f"https://api.linkedin.com/v2/ugcPosts/{linkedin_post_id}" url = f"https://api.linkedin.com/v2/ugcPosts/{linkedin_post_id}"
headers = { headers = {
@@ -165,11 +166,9 @@ def delete_post(recruitment):
} }
response = requests.delete(url, headers=headers) response = requests.delete(url, headers=headers)
if response.status_code == 204: if response.status_code == 204:
# Successfully deleted
recruitment.linkedin_post_id = None recruitment.linkedin_post_id = None
recruitment.save() recruitment.save()
return True return True
else:
return False return False