mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-09 01:35:52 +08:00
4619871e8d
Summary: Fixes: T1334 remove final InboxApp references move out all underscore-plus methods Mass find and replace of underscore-plus sed -i '' -- 's/underscore-plus/underscore/g' **/*.coffee sed -i '' -- 's/underscore-plus/underscore/g' **/*.cjsx Test Plan: edgehill --test Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D1534
26 lines
684 B
CoffeeScript
26 lines
684 B
CoffeeScript
Reflux = require 'reflux'
|
|
_ = require 'underscore'
|
|
{Message,
|
|
DatabaseStore,
|
|
DatabaseView} = require 'nylas-exports'
|
|
|
|
module.exports =
|
|
DraftListStore = Reflux.createStore
|
|
init: ->
|
|
@listenTo DatabaseStore, @_onDataChanged
|
|
|
|
@_view = new DatabaseView Message,
|
|
matchers: [Message.attributes.draft.equal(true)],
|
|
includes: [Message.attributes.body]
|
|
orders: [Message.attributes.date.descending()]
|
|
|
|
@listenTo @_view, => @trigger({})
|
|
|
|
view: ->
|
|
@_view
|
|
|
|
_onDataChanged: (change) ->
|
|
return unless change.objectClass is Message.name
|
|
containsDraft = _.some(change.objects, (msg) -> msg.draft)
|
|
return unless containsDraft
|
|
@_view.invalidate()
|