mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-24 08:04:11 +08:00
Summary: Fix T1822 - saving templates not working, not showing template Fix T1800 - give composers a minimum size Fix the bottom bar of the composer so the gray bar goes all the way across in popout mode. Fix T1825 - switch to a more attractive "June 4, 2015 at 3:10 PM" styling for expanded dates Remove, rather than hide, react components for text fields in composer. Fixes T1147 Fix specs Switch to 999+ instead of infinity. Fixes T1768 Fix broken TemplateStore specs Test Plan: Run tests Reviewers: evan Reviewed By: evan Maniphest Tasks: T1147, T1768, T1822, T1800, T1825 Differential Revision: https://phab.nylas.com/D1601
43 lines
1.2 KiB
CoffeeScript
43 lines
1.2 KiB
CoffeeScript
Reflux = require 'reflux'
|
|
_ = require 'underscore'
|
|
{DatabaseStore, NamespaceStore, Actions, Thread} = require 'nylas-exports'
|
|
remote = require 'remote'
|
|
app = remote.require 'app'
|
|
|
|
AppUnreadCount = null
|
|
|
|
module.exports =
|
|
AppUnreadBadgeStore = Reflux.createStore
|
|
init: ->
|
|
@listenTo NamespaceStore, @_onNamespaceChanged
|
|
@listenTo DatabaseStore, @_onDataChanged
|
|
@_fetchCount()
|
|
|
|
_onNamespaceChanged: ->
|
|
@_onDataChanged()
|
|
|
|
_onDataChanged: (change) ->
|
|
return app.dock?.setBadge?("") unless NamespaceStore.current()
|
|
|
|
if change && change.objectClass is Thread.name
|
|
@_fetchCountDebounced ?= _.debounce(@_fetchCount, 5000)
|
|
@_fetchCountDebounced()
|
|
|
|
_fetchCount: ->
|
|
namespace = NamespaceStore.current()
|
|
return unless namespace
|
|
|
|
DatabaseStore.count(Thread, [
|
|
Thread.attributes.namespaceId.equal(namespace.id),
|
|
Thread.attributes.unread.equal(true),
|
|
Thread.attributes.tags.contains('inbox')
|
|
]).then (count) ->
|
|
return if AppUnreadCount is count
|
|
AppUnreadCount = count
|
|
|
|
if count > 999
|
|
app.dock?.setBadge?("999+")
|
|
else if count > 0
|
|
app.dock?.setBadge?("#{count}")
|
|
else
|
|
app.dock?.setBadge?("")
|