Skip to content

TF-4392 [Team Mailbox] Edit email in Template folder as new in the composer#4420

Open
dab246 wants to merge 1 commit intomasterfrom
bugfix/tf-4392-team-mailbox-open-email-in-template-folder
Open

TF-4392 [Team Mailbox] Edit email in Template folder as new in the composer#4420
dab246 wants to merge 1 commit intomasterfrom
bugfix/tf-4392-team-mailbox-open-email-in-template-folder

Conversation

@dab246
Copy link
Copy Markdown
Member

@dab246 dab246 commented Mar 26, 2026

Issue

#4392
#4333

User story 4

AS a team mailbox member
WHEN I open an email in the Template folder
THEN I edit it as new in the composer

Summary by CodeRabbit

  • Bug Fixes
    • Improved template mailbox detection logic for team mailboxes using case-insensitive name matching
    • Enhanced handling to properly distinguish between personal and team mailbox templates

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 26, 2026

Walkthrough

This change modifies the mailbox extension to differentiate template detection between personal and team mailboxes. A new isTemplatesTeamMailbox getter was introduced to identify team mailboxes with template roles by checking if they are children of team mailboxes and matching the templates role name using case-insensitive comparison. The existing isTemplates getter now uses conditional logic to return the role-based check for personal mailboxes while delegating to the new getter for team mailboxes.

Suggested labels

customer

Suggested reviewers

  • tddang-linagora
  • hoangdat
  • chibenwa
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: enabling team mailbox members to edit emails in the Template folder as new messages in the composer, which aligns with the PR objectives and code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/tf-4392-team-mailbox-open-email-in-template-folder

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between c17782b and b908a94.

📒 Files selected for processing (1)
  • model/lib/extensions/presentation_mailbox_extension.dart

Comment on lines +47 to +53
bool get isTemplates {
if (isPersonal) {
return role == PresentationMailbox.roleTemplates;
} else {
return isTemplatesTeamMailbox;
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

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.

@github-actions
Copy link
Copy Markdown

This PR has been deployed to https://linagora.github.io/tmail-flutter/4420.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant