Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion model/lib/extensions/presentation_mailbox_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,19 @@ extension PresentationMailboxExtension on PresentationMailbox {

bool get isDrafts => role == PresentationMailbox.roleDrafts;

bool get isTemplates => role == PresentationMailbox.roleTemplates;
bool get isTemplates {
if (isPersonal) {
return role == PresentationMailbox.roleTemplates;
} else {
return isTemplatesTeamMailbox;
}
}
Comment on lines +47 to +53
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.


bool get isTemplatesTeamMailbox {
return isChildOfTeamMailboxes &&
name?.name.toLowerCase() ==
PresentationMailbox.templatesRole.toLowerCase();
}

bool get isSent => role == PresentationMailbox.roleSent;

Expand Down
Loading