fix(*): A few small bug fixes, immediate refres on renderer process crash

Summary:
fix(drafts): One failed promsie breaks ChangeSet.commit forever

Move the quoted text button so it's beneath the quoted text not at the bottom of the composer, also fixes problem with it overlapping content slightly

When the main window crashes, reload it immediately

Test Plan: Run tests

Reviewers: evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D1742
This commit is contained in:
Ben Gotow 2015-07-15 13:15:55 -07:00
parent 4fe54c3d1e
commit 309a1291f5
6 changed files with 21 additions and 32 deletions

View file

@ -571,7 +571,7 @@ class ComposerView extends React.Component
# There can be a delay between when the send request gets initiated
# by a user and when the draft is prepared on on the TaskQueue, which
# is how we detect that the draft is sending.
@setState isSending: true
@setState(isSending: true)
Actions.sendDraft(@props.localId)

View file

@ -150,10 +150,8 @@
margin: 0 8px;
.quoted-text-control {
position: absolute;
bottom: 10px;
left: 15px;
margin: 0;
margin: @spacing-standard;
margin-top:0;
}
div[contenteditable] {
@ -166,7 +164,6 @@
margin-bottom: 30px;
}
.contenteditable-container {
display: flex;
width: 100%;
position: relative;
}

View file

@ -182,15 +182,18 @@ class AtomWindow
@browserWindow.webContents.on 'crashed', =>
global.application.exit(100) if @exitWhenDone
dialog = require 'dialog'
chosen = dialog.showMessageBox @browserWindow,
type: 'warning'
buttons: ['Close Window', 'Reload', 'Keep It Open']
message: 'Nylas Mail has crashed'
detail: 'Please report this issue to us at support@nylas.com.'
switch chosen
when 0 then @browserWindow.destroy()
when 1 then @browserWindow.restart()
if @mainWindow
@browserWindow.restart()
else
dialog = require 'dialog'
chosen = dialog.showMessageBox @browserWindow,
type: 'warning'
buttons: ['Close Window', 'Reload', 'Keep It Open']
message: 'Nylas Mail has crashed'
detail: 'Please report this issue to us at support@nylas.com.'
switch chosen
when 0 then @browserWindow.destroy()
when 1 then @browserWindow.restart()
@setupContextMenu()

View file

@ -1,10 +0,0 @@
convenience methods to insert plaintext into draft
documentation of roles
documentation of DraftStore extensions
RetinaImg with bad image name throws exception
when third-party react components throw exceptions, it breaks everything
when typing team @ nylas, undefined react component in dropdown list?

View file

@ -42,14 +42,15 @@ class DraftChangeSet
@_timer = setTimeout(@commit, 5000)
commit: =>
@_commitChain = @_commitChain.then =>
@_commitChain = @_commitChain.finally =>
if Object.keys(@_pending).length is 0
return Promise.resolve(true)
DatabaseStore = require './database-store'
return DatabaseStore.findByLocalId(Message, @localId).then (draft) =>
if not draft
throw new Error("Tried to commit a draft that had already been removed from the database. DraftId: #{@localId}")
throw new Error("DraftChangeSet.commit: Assertion failure. Draft #{@localId} has already been removed from the database.")
@_saving = @_pending
@_pending = {}
draft = @applyToModel(draft)
@ -101,9 +102,8 @@ class DraftStoreProxy
@_draftPromise = Promise.resolve(@)
@prepare().catch (error) ->
console.error(error)
console.error(error.stack)
throw new Error("DraftStoreProxy prepare() failed with error #{error.toString()}.")
throw new Error("DraftStoreProxy prepare() failed: #{error.toString()}.")
# Public: Returns the draft object with the latest changes applied.
#
@ -123,7 +123,7 @@ class DraftStoreProxy
DatabaseStore = require './database-store'
DatabaseStore.findByLocalId(Message, @draftLocalId).then (draft) =>
if not draft
reject(new Error("Can't prepare. Draft is null"))
reject(new Error("Assertion Failure: Draft #{@draftLocalId} not found."))
else
@_setDraft(draft)
resolve(@)

View file

@ -401,8 +401,7 @@ class DraftStore
# Immediately save any pending changes so we don't save after sending
session.changes.commit().then =>
task = new SendDraftTask draftLocalId, {fromPopout: @_isPopout()}
task = new SendDraftTask(draftLocalId, {fromPopout: @_isPopout()})
if atom.isMainWindow()
# We need to wait for performLocal to finish before `trigger`ing.