mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-12 02:58:20 +08:00
df38008c56
Summary: This diff includes a few small things: - Menu: Don't select the first item until the user taps down arrow, and allow the user to use the arrow keys to move up and down through Menu items. - Menu: Make scroll code from MultiselectList re-usable, use in Menu. Now if you use the keys to move to an item that is offscreen it will follow. - Popover: Tapping the button that opened popover should close it - Make sure buttons in toolbars are at least standard height - Re-enable Markdown processing via `grunt docs` - A bit of initial inline documentation for crosjdoc. Need to evaluate whether this is worth doing everywhere. - New `search-playground` package for experimenting with search and search weights. - Swap itemClassProvider for more generic itemPropProvider - Add crojsdoc config file - Export React, because third party packages can't require things from our app - [FEATURE] Bring back static file support in third party packages via `nylas://translate/IMG_20150417_124142.jpg` - Fix invariant error with search bar - [FEATURE] "Show Original" under Message actions - Fix DatabaseView so that many archives at once don't cause problems Test Plan: Run specs Reviewers: evan Reviewed By: evan Differential Revision: https://review.inboxapp.com/D1426
74 lines
2 KiB
CoffeeScript
74 lines
2 KiB
CoffeeScript
Reflux = require 'reflux'
|
|
_ = require 'underscore-plus'
|
|
remote = require 'remote'
|
|
|
|
{NamespaceStore,
|
|
Contact,
|
|
Message,
|
|
Actions,
|
|
DatabaseStore} = require 'inbox-exports'
|
|
|
|
PlaygroundActions = require './playground-actions'
|
|
SearchStore = require './search-store'
|
|
|
|
module.exports =
|
|
RelevanceStore = Reflux.createStore
|
|
init: ->
|
|
@listenTo SearchStore, @_onSearchChanged
|
|
@listenTo PlaygroundActions.setRankNext, @_onSetRankNext
|
|
@listenTo PlaygroundActions.clearRanks, @_onClearRanks
|
|
@listenTo PlaygroundActions.submitRanks, @_onSubmitRanks
|
|
|
|
valueForId: (id) ->
|
|
@_values[id]
|
|
|
|
_onSubmitRanks: ->
|
|
v = SearchStore.view()
|
|
if @_valuesOrdered.length is 0
|
|
return
|
|
|
|
data =
|
|
namespaceId: NamespaceStore.current().id
|
|
query: SearchStore.searchQuery()
|
|
weights: SearchStore.searchWeights()
|
|
returned: [0..Math.min(9, v.count())].map (i) -> v.get(i)?.id
|
|
desired: @_valuesOrdered
|
|
|
|
draft = new Message
|
|
from: [NamespaceStore.current().me()]
|
|
to: [new Contact(name: "Nilas Team", email: "feedback@nilas.com")]
|
|
date: (new Date)
|
|
draft: true
|
|
subject: "Feedback - Search Result Ranking"
|
|
namespaceId: NamespaceStore.current().id
|
|
body: JSON.stringify(data, null, '\t')
|
|
|
|
DatabaseStore.persistModel(draft).then =>
|
|
DatabaseStore.localIdForModel(draft).then (localId) ->
|
|
Actions.sendDraft(localId)
|
|
dialog = remote.require('dialog')
|
|
dialog.showMessageBox remote.getCurrentWindow(), {
|
|
type: 'warning'
|
|
buttons: ['OK'],
|
|
message: "Thank you."
|
|
detail: "Your preferred ranking order for this query has been sent to the Edgehill team."
|
|
}
|
|
@_onClearRanks()
|
|
|
|
_onClearRanks: ->
|
|
@_values = {}
|
|
@_valuesOrdered = []
|
|
@_valueLast = 0
|
|
@trigger(@)
|
|
|
|
_onSetRankNext: (id) ->
|
|
@_values[id] = @_valueLast += 1
|
|
@_valuesOrdered.push(id)
|
|
@trigger(@)
|
|
|
|
_onSearchChanged: ->
|
|
v = SearchStore.view()
|
|
@_values = {}
|
|
@_valuesOrdered = []
|
|
@_valueLast = 0
|
|
@trigger(@)
|