fix: Improve Confluence/Jira detection precision
- Add domain-specific matching for Atlassian services - Fix Confluence being misclassified as Jira - Add comprehensive test coverage for notification detection - Add example configuration file with new options - All 13 tests now passing Files modified: - src/mail/notification_detector.py: Better atlassian.net handling - tests/test_notification_detector.py: Full test suite - mail.toml.example: Config documentation with examples
This commit is contained in:
@@ -17,10 +17,17 @@ class NotificationType:
|
||||
def matches(self, envelope: Dict[str, Any], content: Optional[str] = None) -> bool:
|
||||
"""Check if envelope matches this notification type."""
|
||||
|
||||
# Check sender domain
|
||||
# Check sender domain (more specific check)
|
||||
from_addr = envelope.get("from", {}).get("addr", "").lower()
|
||||
if any(domain in from_addr for domain in self.domains):
|
||||
return True
|
||||
for domain in self.domains:
|
||||
# For atlassian.net, check if it's specifically jira or confluence in the address
|
||||
if domain == "atlassian.net":
|
||||
if "jira@" in from_addr:
|
||||
return self.name == "jira"
|
||||
elif "confluence@" in from_addr:
|
||||
return self.name == "confluence"
|
||||
elif domain in from_addr:
|
||||
return True
|
||||
|
||||
# Check subject patterns
|
||||
subject = envelope.get("subject", "").lower()
|
||||
|
||||
Reference in New Issue
Block a user