mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-01 13:14:16 +08:00
Correctly convert new folder/label names to UTF7
This commit is contained in:
parent
3f944f09cf
commit
33172ed342
5 changed files with 23 additions and 14 deletions
|
@ -65,10 +65,10 @@ onEditItem = (item, value) ->
|
|||
if newDisplayName is category.displayName
|
||||
return
|
||||
|
||||
Actions.queueTask(new SyncbackCategoryTask({
|
||||
Actions.queueTask(SyncbackCategoryTask.forRenaming({
|
||||
accountId: category.accountId,
|
||||
existingPath: category.path,
|
||||
path: newDisplayName,
|
||||
path: category.path,
|
||||
newName: newDisplayName,
|
||||
}))
|
||||
|
||||
|
||||
|
|
|
@ -183,8 +183,8 @@ class SidebarSection
|
|||
onCollapseToggled: onCollapseToggled
|
||||
onItemCreated: (displayName) ->
|
||||
return unless displayName
|
||||
Actions.queueTask(new SyncbackCategoryTask({
|
||||
path: displayName,
|
||||
Actions.queueTask(SyncbackCategoryTask.forCreating({
|
||||
name: displayName,
|
||||
accountId: account.id,
|
||||
}))
|
||||
}
|
||||
|
|
|
@ -99,8 +99,8 @@ export default class LabelPickerPopover extends Component {
|
|||
if (threads.length === 0) return;
|
||||
|
||||
if (item.newCategoryItem) {
|
||||
const syncbackTask = new SyncbackCategoryTask({
|
||||
path: this.state.searchValue,
|
||||
const syncbackTask = SyncbackCategoryTask.forCreating({
|
||||
name: this.state.searchValue,
|
||||
accountId: account.id,
|
||||
});
|
||||
|
||||
|
|
|
@ -129,8 +129,8 @@ export default class MovePickerPopover extends Component {
|
|||
};
|
||||
|
||||
_onCreateCategory = () => {
|
||||
const syncbackTask = new SyncbackCategoryTask({
|
||||
path: this.state.searchValue,
|
||||
const syncbackTask = SyncbackCategoryTask.forCreating({
|
||||
name: this.state.searchValue,
|
||||
accountId: this.props.account.id,
|
||||
});
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import utf7 from 'utf7';
|
||||
import Task from './task';
|
||||
import Attributes from '../attributes';
|
||||
|
||||
|
@ -14,11 +15,19 @@ export default class SyncbackCategoryTask extends Task {
|
|||
}),
|
||||
});
|
||||
|
||||
constructor({ existingPath, path, accountId, ...rest } = {}) {
|
||||
super(rest);
|
||||
this.existingPath = existingPath;
|
||||
this.path = path;
|
||||
this.accountId = accountId;
|
||||
static forCreating({ name, accountId }) {
|
||||
return new SyncbackCategoryTask({
|
||||
path: utf7.imap.encode(name),
|
||||
accountId: accountId,
|
||||
});
|
||||
}
|
||||
|
||||
static forRenaming({ path, accountId, newName }) {
|
||||
return new SyncbackCategoryTask({
|
||||
existingPath: path,
|
||||
path: utf7.imap.encode(newName),
|
||||
accountId: accountId,
|
||||
});
|
||||
}
|
||||
|
||||
label() {
|
||||
|
|
Loading…
Reference in a new issue