Skip to content

Commit

Permalink
fixup! Detect and persist the personal namespace
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst committed Sep 1, 2020
1 parent bbe3e22 commit c3c6996
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ export default {
commit('removeMailbox', { id: mailbox.databaseId })
},
async createMailbox({ commit }, { account, name }) {
const prefixed = (account.personalNamespace && name.startsWith(account.personalNamespace)) ? name : account.personalNamespace + name
const prefixed = (account.personalNamespace && !name.startsWith(account.personalNamespace))
? account.personalNamespace + name
: name
const mailbox = await createMailbox(account.id, prefixed)
console.debug(`mailbox ${prefixed} created for account ${account.id}`, { mailbox })
commit('addMailbox', { account, mailbox })
Expand Down
6 changes: 3 additions & 3 deletions src/store/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ const addMailboxToState = curry((state, account, mailbox) => {
mailbox.envelopeLists = {}

// Add all mailboxes (including submailboxes to state, but only toplevel to account
const nameWithoutPrefix = account.personalNamespace ?
mailbox.name.replace(new RegExp(escapeRegExp(account.personalNamespace)), '') :
mailbox.name
const nameWithoutPrefix = account.personalNamespace
? mailbox.name.replace(new RegExp(escapeRegExp(account.personalNamespace)), '')
: mailbox.name
if (nameWithoutPrefix.includes(mailbox.delimiter)) {
/**
* Sub-mailbox, e.g. 'Archive.2020' or 'INBOX.Archive.2020'
Expand Down

0 comments on commit c3c6996

Please sign in to comment.