Skip to content

Conversation

@mileo
Copy link
Member

@mileo mileo commented Jul 10, 2025

This PR fixes a critical issue with email loop detection in the helpdesk.ticket model by adding the missing _primary_email attribute, which prevents spam and duplicate ticket creation through email aliases.

Problem

The helpdesk.ticket model was missing the _primary_email attribute, causing the following issues:

  1. No spam protection: The system couldn't detect when the same email address was creating multiple tickets in a short time period
  2. Duplicate tickets: Multiple tickets could be created from the same email address without any loop detection
  3. Log warnings: The system was logging "Primary email missing on helpdesk.ticket" messages
  4. Inconsistent behavior: Different behavior between Community and Enterprise versions

Root Cause

The _detect_loop_sender_domain method in mail.thread relies on the _primary_email attribute to:

  • Create search domains for detecting duplicate records
  • Prevent spam by monitoring email frequency
  • Associate incoming emails with existing records

When _primary_email is not defined, the method returns None, effectively disabling loop detection for that model.

@mileo mileo changed the title [16.0[FIX] _primary_email [16.0][FIX] _primary_email Jul 10, 2025
@pedrobaeza pedrobaeza added this to the 16.0 milestone Jul 11, 2025
@pedrobaeza
Copy link
Member

Thanks for this. Can you please rename to [IMP] helpdesk_mgmt: Set _primary_email according commit message guidelines? https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#commit-message

@flotho
Copy link
Member

flotho commented Jul 22, 2025

Hi @mileo thanks for your PR.
Any chance to follow the guidelines pointed by @pedrobaeza ?

Regards

@github-actions
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Nov 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale PR/Issue without recent activity, it'll be soon closed automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants