-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MailboxPicker #3571
MailboxPicker #3571
Conversation
src/components/MailboxPicker.vue
Outdated
}, | ||
methods: { | ||
getMailboxes(root, folderid) { | ||
let folders = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let folders = [] | |
let mailboxes = [] |
for consistency :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now need 2 arrays here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily. Instead of iterating on one array and filling another one (imperative coding) you can map the mailboxes to the new data structure and just return the result. No need to store anything a second time. If that's too much to ask then leave it and I can clean up the code later ✌️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's definitly not too much to ask, I simply do not understand how to do that. Can you give me a hint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I'm sorry for not explaining it.
Currently you do
let mailboxes = ...
const boxLevel = []
mailboxes.forEach((folder) => {
...
boxLevel.push({ ... })
})
return boxLevel
but you can simplify to
let mailboxes = ...
return mailboxes.map((mailbox) => {
return {
...,
children: this.getMailboxes(mailbox.databseId)
}
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, strange syntax ;-) Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wörks nicely!
I guess we can improve the styling later on with icons and so on, but it's a great start. Thanks a lot!
Please remove the component from the settings page again, squash and rebase your comments then I'll integrate :) |
Signed-off-by: Holger Dehnhardt <holger@dehnhardt.org>
f6c074b
to
afba6d4
Compare
Done. |
@ChristophWurst and @st3iny: I split the mailbox picker out of the big PR and incorporated Christoph's comments.
For viewing and testing I simply added a mailbox picker to the account settings. Before the merge we remove this ;-)