fix: Delete all company websites on save, not just specific sources
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

Prevents duplicates when migration_fix or other source records exist.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-02-17 08:39:03 +01:00
parent 9c24c8bbab
commit ab7a7ef233

View File

@ -261,13 +261,9 @@ def _save_social_media(db, company):
def _save_websites(db, company):
"""Save multiple website URLs from the contacts tab."""
# Delete existing editable websites
# Delete all existing websites — user edits the full list
db.query(CompanyWebsite).filter(
CompanyWebsite.company_id == company.id,
or_(
CompanyWebsite.source.in_(['manual_edit', 'manual', 'migration']),
CompanyWebsite.source.is_(None)
)
CompanyWebsite.company_id == company.id
).delete(synchronize_session='fetch')
website_urls = request.form.getlist('website_urls[]')