fix(message-list-toolbar): Fix observable for selection & focused thread

This commit is contained in:
Juan Tejada 2016-03-22 11:28:16 -07:00
parent 9bbaf3b90d
commit dfd051339d
2 changed files with 11 additions and 19 deletions

View file

@ -8,23 +8,16 @@ import InjectsToolbarButtons, {ToolbarRole} from './injects-toolbar-buttons'
function getObservable() {
return (
Rx.Observable.merge(
Rx.Observable.combineLatest(
Rx.Observable.fromStore(FocusedContentStore),
ThreadListStore.selectionObservable(),
(store, items) => ({focusedThread: store.focused('thread'), items})
)
.map((data) => {
const storeChanged = data === FocusedContentStore
const selectionChanged = data instanceof Array
if (storeChanged) {
const focusedThread = FocusedContentStore.focused('thread')
if (focusedThread) {
return [focusedThread]
}
} else if (selectionChanged) {
return data
.map(({focusedThread, items}) => {
if (focusedThread) {
return [focusedThread]
}
return []
return items
})
)
}

View file

@ -86,12 +86,11 @@ Rx.Observable.fromListSelection = (originStore) =>
)
return
)
return {
dispose: =>
if dataSourceDisposable
dataSourceDisposable.dispose()
disposable.dispose()
}
dispose = =>
if dataSourceDisposable
dataSourceDisposable.dispose()
disposable.dispose()
return Rx.Disposable.create(dispose)
)
Rx.Observable.fromConfig = (configKey) =>