hotfix: Set not event-email when search email as default#4451
hotfix: Set not event-email when search email as default#4451
Conversation
Signed-off-by: dab246 <tdvu@linagora.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughAdded an import for Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
lib/features/mailbox_dashboard/presentation/model/search/search_email_filter.dart (1)
161-164: Consider guarding explicit Events inclusion beyondhasKeyword.Right now, only
hasKeyworddisables the defaultnotKeyword(events)clause. If Events can be selected via another path (e.g.,label.keyword), this can create contradictory filters. Consider centralizing anisEventsExplicitlyIncludedcheck.♻️ Suggested hardening
+ final isEventsExplicitlyIncluded = + hasKeyword.contains(KeyWordIdentifierExtension.eventsMail.value) || + label?.keyword?.value == KeyWordIdentifierExtension.eventsMail.value; + final listEmailCondition = { if (emailEmailFilterConditionShared.hasCondition) emailEmailFilterConditionShared, @@ - if (!hasKeyword.contains(KeyWordIdentifierExtension.eventsMail.value)) + if (!isEventsExplicitlyIncluded) EmailFilterCondition( notKeyword: KeyWordIdentifierExtension.eventsMail.value, ),🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/features/mailbox_dashboard/presentation/model/search/search_email_filter.dart` around lines 161 - 164, The code currently only checks hasKeyword before adding an EmailFilterCondition(notKeyword: KeyWordIdentifierExtension.eventsMail.value), which can conflict if Events are included via another path (e.g., label.keyword); add a centralized boolean (e.g., isEventsExplicitlyIncluded) that returns true when hasKeyword OR any other explicit include (like label?.keyword == KeyWordIdentifierExtension.eventsMail.value or other selection flags) and then replace the hasKeyword check with !isEventsExplicitlyIncluded before emitting EmailFilterCondition(notKeyword: KeyWordIdentifierExtension.eventsMail.value); update the logic where EmailFilterCondition is created so all places consult isEventsExplicitlyIncluded to avoid contradictory filters.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@lib/features/mailbox_dashboard/presentation/model/search/search_email_filter.dart`:
- Around line 161-164: Update the tests to reflect that
mappingToEmailFilterCondition() now returns a non-null EmailFilterCondition for
the initial filter because Events (KeyWordIdentifierExtension.eventsMail) is
excluded by default; specifically modify the assertions in
test/features/search/search_email_filter_test.dart starting around line 81 to
expect a non-null EmailFilterCondition with notKeyword ==
KeyWordIdentifierExtension.eventsMail.value, and add a new test case that
verifies an explicit “include Events” scenario (i.e., when hasKeyword includes
KeyWordIdentifierExtension.eventsMail.value the mapping returns null or an
EmailFilterCondition without notKeyword as appropriate).
---
Nitpick comments:
In
`@lib/features/mailbox_dashboard/presentation/model/search/search_email_filter.dart`:
- Around line 161-164: The code currently only checks hasKeyword before adding
an EmailFilterCondition(notKeyword:
KeyWordIdentifierExtension.eventsMail.value), which can conflict if Events are
included via another path (e.g., label.keyword); add a centralized boolean
(e.g., isEventsExplicitlyIncluded) that returns true when hasKeyword OR any
other explicit include (like label?.keyword ==
KeyWordIdentifierExtension.eventsMail.value or other selection flags) and then
replace the hasKeyword check with !isEventsExplicitlyIncluded before emitting
EmailFilterCondition(notKeyword: KeyWordIdentifierExtension.eventsMail.value);
update the logic where EmailFilterCondition is created so all places consult
isEventsExplicitlyIncluded to avoid contradictory filters.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e61aa082-96e8-4da3-a030-22c8a4bfe505
📒 Files selected for processing (1)
lib/features/mailbox_dashboard/presentation/model/search/search_email_filter.dart
Signed-off-by: dab246 <tdvu@linagora.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
test/features/search/search_email_filter_test.dart (1)
121-135: Assert the events exclusion explicitly here.Line 135 only checks the condition count, so this can still pass if the third condition is unrelated. Since this hotfix is specifically about the default events exclusion, assert that one
EmailFilterConditionhasnotKeyword == KeyWordIdentifierExtension.eventsMail.value, not just that there are three entries.Suggested test hardening
expect(result, isA<LogicFilterOperator>()); final logicOperator = result as LogicFilterOperator; expect(logicOperator.operator, Operator.AND); expect(logicOperator.conditions.length, equals(3)); + expect( + logicOperator.conditions.whereType<EmailFilterCondition>().any( + (condition) => + condition.notKeyword == + KeyWordIdentifierExtension.eventsMail.value, + ), + isTrue, + );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/features/search/search_email_filter_test.dart` around lines 121 - 135, The test for SearchEmailFilter.mappingToEmailFilterCondition currently only checks there are three conditions but doesn't verify the default events exclusion; update the test to explicitly assert that among the LogicFilterOperator.conditions (from mappingToEmailFilterCondition) there exists an EmailFilterCondition whose notKeyword equals KeyWordIdentifierExtension.eventsMail.value, while keeping the existing checks for operator AND and total length; refer to SearchEmailFilter.mappingToEmailFilterCondition, LogicFilterOperator, EmailFilterCondition, and the notKeyword/KeyWordIdentifierExtension.eventsMail.value identifiers to locate and add the assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/features/search/search_email_filter_test.dart`:
- Around line 246-260: Add two additional test cases around
SearchEmailFilter.mappingToEmailFilterCondition to catch membership bugs: (1)
when hasKeyword contains a non-events keyword (ensure
EmailFilterCondition.notKeyword is the events exclusion and hasKeyword reflects
only the provided non-events value), and (2) when hasKeyword contains eventsMail
plus another keyword (ensure eventsMail presence prevents setting notKeyword
while hasKeyword includes both values). Use
KeyWordIdentifierExtension.eventsMail.value and other keyword identifiers, and
assert EmailFilterCondition.hasKeyword and EmailFilterCondition.notKeyword
accordingly to validate membership rather than exact-set equality.
---
Nitpick comments:
In `@test/features/search/search_email_filter_test.dart`:
- Around line 121-135: The test for
SearchEmailFilter.mappingToEmailFilterCondition currently only checks there are
three conditions but doesn't verify the default events exclusion; update the
test to explicitly assert that among the LogicFilterOperator.conditions (from
mappingToEmailFilterCondition) there exists an EmailFilterCondition whose
notKeyword equals KeyWordIdentifierExtension.eventsMail.value, while keeping the
existing checks for operator AND and total length; refer to
SearchEmailFilter.mappingToEmailFilterCondition, LogicFilterOperator,
EmailFilterCondition, and the
notKeyword/KeyWordIdentifierExtension.eventsMail.value identifiers to locate and
add the assertion.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cf4925bc-fa87-4cb3-8559-09ecbed4620e
📒 Files selected for processing (1)
test/features/search/search_email_filter_test.dart
|
This PR has been deployed to https://linagora.github.io/tmail-flutter/4451. |
There was a problem hiding this comment.
Gates Passed
3 Quality Gates Passed
See analysis details in CodeScene
Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
|
Well I STRONGLY disagree with that change. I do believe that pleople are actually interested in email about event and might actually actively look for them. I thus challenge this functionnal requirement that I believe is misplaced. What are other email providers doing? Is GMail for instance actively filtering out events from my email search ? Cc @poupotte |
Summary by CodeRabbit
Bug Fixes
Tests