TF-4392 [Team Mailbox] Edit email in Template folder as new in the composer#4420
TF-4392 [Team Mailbox] Edit email in Template folder as new in the composer#4420
Conversation
WalkthroughThis change modifies the mailbox extension to differentiate template detection between personal and team mailboxes. A new 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
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@model/lib/extensions/presentation_mailbox_extension.dart`:
- Around line 47-53: The non-personal branch of the isTemplates getter drops the
role-based check and can misclassify team template folders; update the
isTemplates implementation to return true if either role ==
PresentationMailbox.roleTemplates OR isTemplatesTeamMailbox for non-personal
mailboxes (i.e., preserve the role check alongside the name/team-detection).
Apply the same change to the other similar getter(s) in this file (the second
block referenced around lines 55-59) so they also include a role ==
PresentationMailbox.roleTemplates check in their non-personal logic.
🪄 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: 252666a3-0e64-476d-be37-3557b4dcc4ce
📒 Files selected for processing (1)
model/lib/extensions/presentation_mailbox_extension.dart
| bool get isTemplates { | ||
| if (isPersonal) { | ||
| return role == PresentationMailbox.roleTemplates; | ||
| } else { | ||
| return isTemplatesTeamMailbox; | ||
| } | ||
| } |
There was a problem hiding this comment.
Preserve role-based template detection for team mailboxes to avoid false negatives.
On Line 50-Line 52, non-personal mailboxes no longer consider role == PresentationMailbox.roleTemplates. This can misclassify valid team template folders when role is set but name is not exactly "templates".
Proposed fix
bool get isTemplates {
if (isPersonal) {
return role == PresentationMailbox.roleTemplates;
- } else {
- return isTemplatesTeamMailbox;
}
+ return role == PresentationMailbox.roleTemplates || isTemplatesTeamMailbox;
}
bool get isTemplatesTeamMailbox {
+ final mailboxName = name?.name;
return isChildOfTeamMailboxes &&
- name?.name.toLowerCase() ==
+ mailboxName?.toLowerCase() ==
PresentationMailbox.templatesRole.toLowerCase();
}Also applies to: 55-59
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@model/lib/extensions/presentation_mailbox_extension.dart` around lines 47 -
53, The non-personal branch of the isTemplates getter drops the role-based check
and can misclassify team template folders; update the isTemplates implementation
to return true if either role == PresentationMailbox.roleTemplates OR
isTemplatesTeamMailbox for non-personal mailboxes (i.e., preserve the role check
alongside the name/team-detection). Apply the same change to the other similar
getter(s) in this file (the second block referenced around lines 55-59) so they
also include a role == PresentationMailbox.roleTemplates check in their
non-personal logic.
|
This PR has been deployed to https://linagora.github.io/tmail-flutter/4420. |
Issue
#4392
#4333
User story 4
Summary by CodeRabbit