mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-16 21:20:23 +08:00
Fix progress var instantiation in send-draft task
This commit is contained in:
parent
7c71576192
commit
e615eece3a
1 changed files with 8 additions and 5 deletions
|
@ -37,8 +37,6 @@ module.exports =
|
||||||
class SendDraftTask extends Task
|
class SendDraftTask extends Task
|
||||||
|
|
||||||
constructor: (@draft, @uploads) ->
|
constructor: (@draft, @uploads) ->
|
||||||
@_progress = new MultiRequestProgressMonitor()
|
|
||||||
Object.defineProperty(@, 'progress', { get: -> @_progress.value() })
|
|
||||||
super
|
super
|
||||||
|
|
||||||
label: ->
|
label: ->
|
||||||
|
@ -63,8 +61,11 @@ class SendDraftTask extends Task
|
||||||
.catch(@_onError)
|
.catch(@_onError)
|
||||||
|
|
||||||
_uploadAttachments: =>
|
_uploadAttachments: =>
|
||||||
|
@_progress = new MultiRequestProgressMonitor()
|
||||||
|
Object.defineProperty(@, 'progress', { get: -> @_progress.value() })
|
||||||
|
|
||||||
Promise.all @uploads.map ({targetPath, size}) =>
|
Promise.all @uploads.map ({targetPath, size}) =>
|
||||||
NylasAPI.makeRequest
|
NylasAPI.makeRequest(
|
||||||
path: "/files"
|
path: "/files"
|
||||||
accountId: @draft.accountId
|
accountId: @draft.accountId
|
||||||
method: "POST"
|
method: "POST"
|
||||||
|
@ -77,10 +78,12 @@ class SendDraftTask extends Task
|
||||||
started: (req) =>
|
started: (req) =>
|
||||||
@_progress.add(targetPath, size, req)
|
@_progress.add(targetPath, size, req)
|
||||||
timeout: 20 * 60 * 1000
|
timeout: 20 * 60 * 1000
|
||||||
|
)
|
||||||
|
.then((file) =>
|
||||||
|
@draft.files.push(file)
|
||||||
|
)
|
||||||
.finally =>
|
.finally =>
|
||||||
@_progress.remove(targetPath)
|
@_progress.remove(targetPath)
|
||||||
.then (file) =>
|
|
||||||
@draft.files.push(file)
|
|
||||||
|
|
||||||
_sendAndCreateMessage: =>
|
_sendAndCreateMessage: =>
|
||||||
NylasAPI.makeRequest
|
NylasAPI.makeRequest
|
||||||
|
|
Loading…
Reference in a new issue