mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-10 02:03:07 +08:00
dff5465931
Summary: ThreadStore should be done loading as soon as threads are available SearchSuggestionStore should use ContactsStore for contact results Contact Store should not "filter all, take 10" it should only filter until it has 10. It should also check against "Ben Gotow" as well as "Ben" and "Gotow", so I can type "Ben Go" Sometimes participants are "Ben Gotow <ben@g.com>", "ben@g.com". If we get zero contacts after removing Me, put "Me" back in... Fix "Update Available" notification, broken reference to `atom.views.getView(atom.workspace)` A bit more debugging around cursors. Need to handle this case soon. Only use atomWorkspace if it exists. Fix for dragging next to / around toolbar window controls Consolidate the display of Contacts in menus into a single MenuItem subclass Update Template Popover styling fetchFromCache should only remove thread loading indicator *IF* it found results in the cache. Doh... Give the thread list "Name" column a fixed width (mg) Better styling of message list collapsed mode, rage against user selection and cursor: pointer Occasionally admin.inboxapp.com returns bogus data Sebaastian feedback on thread list Test Plan: Run tests Reviewers: evan Reviewed By: evan Differential Revision: https://review.inboxapp.com/D1350
81 lines
2 KiB
CoffeeScript
81 lines
2 KiB
CoffeeScript
Reflux = require 'reflux'
|
|
{Actions,
|
|
Contact,
|
|
ContactStore} = require 'inbox-exports'
|
|
_ = require 'underscore-plus'
|
|
|
|
# Stores should closely match the needs of a particular part of the front end.
|
|
# For example, we might create a "MessageStore" that observes this store
|
|
# for changes in selectedThread, "DatabaseStore" for changes to the underlying database,
|
|
# and vends up the array used for that view.
|
|
|
|
SearchSuggestionStore = Reflux.createStore
|
|
init: ->
|
|
@_suggestions = []
|
|
@_searchConstants = {"from": 4, "subject": 2}
|
|
@_query = ""
|
|
@_committedQuery = ""
|
|
|
|
@listenTo Actions.searchConstantsChanged, @onSearchConstantsChanged
|
|
@listenTo Actions.searchQueryChanged, @onSearchQueryChanged
|
|
@listenTo Actions.searchQueryCommitted, @onSearchQueryCommitted
|
|
@listenTo Actions.searchBlurred, @onSearchBlurred
|
|
|
|
onSearchQueryChanged: (query) ->
|
|
@_query = query
|
|
@repopulate()
|
|
|
|
onSearchConstantsChanged: (constants) ->
|
|
@_searchConstants = constants
|
|
@trigger()
|
|
Actions.searchQueryCommitted(@_query)
|
|
|
|
onSearchQueryCommitted: (query) ->
|
|
@_query = query
|
|
@_committedQuery = query
|
|
@_suggestions = []
|
|
@trigger()
|
|
|
|
onSearchBlurred: ->
|
|
@_suggestions = []
|
|
@trigger()
|
|
|
|
repopulate: ->
|
|
@_suggestions = []
|
|
term = @_query?[0]
|
|
return @trigger(@) unless term
|
|
|
|
key = Object.keys(term)[0]
|
|
val = term[key]?.toLowerCase()
|
|
return @trigger(@) unless val
|
|
|
|
contactResults = ContactStore.searchContacts(val, limit:10)
|
|
|
|
@_suggestions.push
|
|
label: "Message Contains: #{val}"
|
|
value: [{"all": val}]
|
|
|
|
if contactResults.length
|
|
@_suggestions.push
|
|
divider: 'People'
|
|
|
|
_.each contactResults, (contact) =>
|
|
@_suggestions.push
|
|
contact: contact
|
|
value: [{"participants": contact.email}]
|
|
|
|
@trigger(@)
|
|
|
|
# Exposed Data
|
|
|
|
query: -> @_query
|
|
|
|
committedQuery: -> @_committedQuery
|
|
|
|
suggestions: ->
|
|
@_suggestions
|
|
|
|
searchConstants: ->
|
|
@_searchConstants
|
|
|
|
module.exports = SearchSuggestionStore
|