Skip to content

Commit

Permalink
Simplify generating folderListVisible
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Feb 11, 2024
1 parent bb906e6 commit 5225b62
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 39 deletions.
21 changes: 0 additions & 21 deletions dev/Styles/User/FolderList.less
Original file line number Diff line number Diff line change
Expand Up @@ -185,27 +185,6 @@
li li li li li a {
text-indent: 4em;
}

/**/
&.single-root-inbox .b-folders-user > li > a {
display: none !important;
}

&.single-root-inbox {
li li a {
text-indent: 0;
}
li li li a {
text-indent: 1em;
}
li li li li a {
text-indent: 2em;
}
li li li li li a {
text-indent: 3em;
}
}
/**/
}

#rl-left .buttonCompose {
Expand Down
19 changes: 2 additions & 17 deletions dev/View/User/MailBox/FolderList.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export class MailFolderList extends AbstractViewLeft {

this.moveAction = moveAction;

this.foldersListWithSingleInboxRootFolder = ko.observable(false);

this.allowContacts = AppUserStore.allowContacts();

this.foldersFilter = foldersFilter;
Expand All @@ -45,23 +43,10 @@ export class MailFolderList extends AbstractViewLeft {
foldersFilterVisible: () => 20 < FolderUserStore.folderList().CountRec,

folderListVisible: () => {
let multiple = false,
inbox, visible,
result = FolderUserStore.folderList().filter(folder => {
if (folder.isInbox()) {
inbox = folder;
}
visible = folder.visible();
multiple |= visible && !folder.isInbox();
return visible;
});
if (inbox && !multiple) {
inbox.collapsed(false);
}
this.foldersListWithSingleInboxRootFolder(!multiple);
let result = FolderUserStore.folderList().filter(folder => folder.visible());
// https://github.com/the-djmaze/snappymail/issues/1427
// result.sort((a, b) => a.unreadEmails ? (b.unreadEmails ? 0 : -1) : (b.unreadEmails ? 1 : 0));
return result;
return 1 === result.length && result[0].isInbox() ? result[0].subFolders() : result;
}
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="b-folders g-ui-user-select-none" data-bind="css: {'single-root-inbox': foldersListWithSingleInboxRootFolder}">
<div class="b-folders g-ui-user-select-none">
<div class="b-toolbar btn-toolbar">
<a class="btn buttonCompose" data-bind="click: composeClick, css: {'btn-warning': composeInEdit, 'btn-success': !composeInEdit()}" data-i18n="[title]FOLDER_LIST/BUTTON_NEW_MESSAGE">
<i class="icon-paper-plane"></i>
Expand Down

0 comments on commit 5225b62

Please sign in to comment.