fix(sidebar): Prevent editing items in OutlineView when not allowed

- Fix check in OutlineViewItem
This commit is contained in:
Juan Tejada 2016-01-28 16:20:46 -08:00
parent decd7c787e
commit 0c3ca4b6e4
3 changed files with 8 additions and 6 deletions

View file

@ -96,8 +96,8 @@ class SidebarItem
@forCategories: (categories = [], opts = {}) ->
id = idForCategories(categories)
perspective = MailboxPerspective.forCategories(categories)
opts.deletable = true
opts.editable = true
opts.deletable ?= true
opts.editable ?= true
@forPerspective(id, perspective, opts)
@forStarred: (accountIds, opts = {}) ->

View file

@ -35,7 +35,7 @@ class SidebarSection
items = _
.reject(cats, (cat) -> cat.name is 'drafts')
.map (cat) => SidebarItem.forCategories([cat])
.map (cat) => SidebarItem.forCategories([cat], editable: false, deletable: false)
starredItem = SidebarItem.forStarred([account.id])
draftsItem = SidebarItem.forDrafts([account.id])
@ -73,9 +73,9 @@ class SidebarSection
names.map((name) -> CategoryStore.getStandardCategory(acc, name))
))
return unless cat
children.push(SidebarItem.forCategories([cat], name: acc.label))
children.push(SidebarItem.forCategories([cat], name: acc.label, editable: false, deletable: false))
items.push SidebarItem.forCategories(categories, {children})
items.push SidebarItem.forCategories(categories, {children, editable: false, deletable: false})
starredItem = SidebarItem.forStarred(_.pluck(accounts, 'id'),
children: accounts.map (acc) -> SidebarItem.forStarred([acc.id], name: acc.label)

View file

@ -218,7 +218,9 @@ class OutlineViewItem extends Component {
}
_onEdit = ()=> {
this.setState({editing: true});
if (this.props.item.onEdited) {
this.setState({editing: true});
}
}
_onInputFocus = (event)=> {