rename(drafts) DraftStoreProxy => DraftEditingSession

This commit is contained in:
Ben Gotow 2016-04-19 16:08:58 -07:00
parent 585dab7cdf
commit ca24fc31e9
9 changed files with 102 additions and 102 deletions

View file

@ -1344,7 +1344,7 @@
5496551: src/flux/stores/draft-store.js
3904826: src/global/nylas-exports.js
3915554: src/flux/models/file.js
5525126: src/flux/stores/draft-store-proxy.js
5525126: src/flux/stores/draft-editing-session.js
3918342: src/flux/tasks/task.js
5544893: src/flux/stores/contact-store.js
3926563: src/flux/models/event.js
@ -1784,7 +1784,7 @@
6736746: src/components/flexbox.js
6738843: src/components/injected-component-set.js
6746664: src/components/unsafe-component.js
5525126: src/flux/stores/draft-store-proxy.js
5525126: src/flux/stores/draft-editing-session.js
6752536: src/components/injected-component-label.js
6754516: src/components/resizable-region.js
5544893: src/flux/stores/contact-store.js
@ -3674,7 +3674,7 @@
5487233: src/mail-rules-templates.js
5491170: src/components/scenario-editor-models.js
5496551: src/flux/stores/draft-store.js
5525126: src/flux/stores/draft-store-proxy.js
5525126: src/flux/stores/draft-editing-session.js
5544893: src/flux/stores/contact-store.js
5558283: src/flux/stores/contact-ranking-store.js
5583627: src/flux/stores/focused-perspective-store.js
@ -5166,7 +5166,7 @@
5487233: src/mail-rules-templates.js
5491170: src/components/scenario-editor-models.js
5496551: src/flux/stores/draft-store.js
5525126: src/flux/stores/draft-store-proxy.js
5525126: src/flux/stores/draft-editing-session.js
5544893: src/flux/stores/contact-store.js
5558283: src/flux/stores/contact-ranking-store.js
5583627: src/flux/stores/focused-perspective-store.js

View file

@ -439,11 +439,11 @@ export default class ComposerView extends React.Component {
}
_onBodyChanged = (event) => {
this._addToProxy({body: this._showQuotedText(event.target.value)});
this._applyChanges({body: this._showQuotedText(event.target.value)});
return;
}
_addToProxy = (changes = {}, source = {}) => {
_applyChanges = (changes = {}, source = {}) => {
const selections = this._getSelections();
this.props.session.changes.add(changes);
@ -560,7 +560,7 @@ export default class ComposerView extends React.Component {
}
this._recoveredSelection = historyItem.currentSelection;
this._addToProxy(historyItem.state, {fromUndoManager: true});
this._applyChanges(historyItem.state, {fromUndoManager: true});
this._recoveredSelection = null;
}
@ -572,7 +572,7 @@ export default class ComposerView extends React.Component {
return;
}
this._recoveredSelection = historyItem.currentSelection;
this._addToProxy(historyItem.state, {fromUndoManager: true});
this._applyChanges(historyItem.state, {fromUndoManager: true});
this._recoveredSelection = null;
}

View file

@ -21,7 +21,7 @@ ReactTestUtils = require('react-addons-test-utils')
{InjectedComponent, ParticipantsTextField} = require 'nylas-component-kit'
DraftStoreProxy = require '../../../src/flux/stores/draft-store-proxy'
DraftEditingSession = require '../../../src/flux/stores/draft-editing-session'
ComposerEditor = require '../lib/composer-editor'
Fields = require '../lib/fields'
@ -46,8 +46,8 @@ DRAFT_CLIENT_ID = "local-123"
useDraft = (draftAttributes={}) ->
@draft = new Message _.extend({draft: true, body: ""}, draftAttributes)
@draft.clientId = DRAFT_CLIENT_ID
@proxy = new DraftStoreProxy(DRAFT_CLIENT_ID, @draft)
DraftStore._draftSessions[DRAFT_CLIENT_ID] = @proxy
@session = new DraftEditingSession(DRAFT_CLIENT_ID, @draft)
DraftStore._draftSessions[DRAFT_CLIENT_ID] = @session
useFullDraft = ->
useDraft.call @,
@ -62,7 +62,7 @@ useFullDraft = ->
makeComposer = (props={}) ->
@composer = NylasTestUtils.renderIntoDocument(
<ComposerView draft={@draft} session={@proxy} {...props} />
<ComposerView draft={@draft} session={@session} {...props} />
)
advanceClock()
@ -73,7 +73,7 @@ describe "ComposerView", ->
@isSending = false
spyOn(DraftStore, "isSendingDraft").andCallFake => @isSending
spyOn(DraftStoreProxy.prototype, '_changeSetCommit').andCallFake (draft) =>
spyOn(DraftEditingSession.prototype, '_changeSetCommit').andCallFake (draft) =>
@draft = draft
spyOn(ContactStore, "searchContacts").andCallFake (email) =>
return _.filter(users, (u) u.email.toLowerCase() is email.toLowerCase())
@ -91,12 +91,12 @@ describe "ComposerView", ->
useDraft.call(@)
makeComposer.call(@)
editableNode = ReactDOM.findDOMNode(@composer).querySelector('[contenteditable]')
spyOn(@proxy.changes, "add")
spyOn(@session.changes, "add")
editableNode.innerHTML = "Hello <strong>world</strong>"
@composer.refs[Fields.Body]._onDOMMutated(["mutated"])
expect(@proxy.changes.add).toHaveBeenCalled()
expect(@proxy.changes.add.calls.length).toBe 1
body = @proxy.changes.add.calls[0].args[0].body
expect(@session.changes.add).toHaveBeenCalled()
expect(@session.changes.add.calls.length).toBe 1
body = @session.changes.add.calls[0].args[0].body
expect(body).toBe "<head></head><body>Hello <strong>world</strong></body>"
describe "when sending a reply-to message", ->
@ -111,7 +111,7 @@ describe "ComposerView", ->
makeComposer.call @
@editableNode = ReactDOM.findDOMNode(@composer).querySelector('[contenteditable]')
spyOn(@proxy.changes, "add")
spyOn(@session.changes, "add")
it 'begins with the replying message collapsed', ->
expect(@editableNode.innerHTML).toBe ""
@ -119,9 +119,9 @@ describe "ComposerView", ->
it 'saves the full new body, plus quoted text', ->
@editableNode.innerHTML = "Hello <strong>world</strong>"
@composer.refs[Fields.Body]._onDOMMutated(["mutated"])
expect(@proxy.changes.add).toHaveBeenCalled()
expect(@proxy.changes.add.calls.length).toBe 1
body = @proxy.changes.add.calls[0].args[0].body
expect(@session.changes.add).toHaveBeenCalled()
expect(@session.changes.add.calls.length).toBe 1
body = @session.changes.add.calls[0].args[0].body
expect(body).toBe """<head></head><body>Hello <strong>world</strong>#{@replyBody}</body>"""
describe "when sending a forwarded message message", ->
@ -143,7 +143,7 @@ describe "ComposerView", ->
makeComposer.call @
@editableNode = ReactDOM.findDOMNode(@composer).querySelector('[contenteditable]')
spyOn(@proxy.changes, "add")
spyOn(@session.changes, "add")
it 'begins with the forwarded message expanded', ->
expect(@editableNode.innerHTML).toBe @fwdBody
@ -151,9 +151,9 @@ describe "ComposerView", ->
it 'saves the full new body, plus forwarded text', ->
@editableNode.innerHTML = "Hello <strong>world</strong>#{@fwdBody}"
@composer.refs[Fields.Body]._onDOMMutated(["mutated"])
expect(@proxy.changes.add).toHaveBeenCalled()
expect(@proxy.changes.add.calls.length).toBe 1
body = @proxy.changes.add.calls[0].args[0].body
expect(@session.changes.add).toHaveBeenCalled()
expect(@session.changes.add.calls.length).toBe 1
body = @session.changes.add.calls[0].args[0].body
expect(body).toBe """Hello <strong>world</strong>#{@fwdBody}"""
describe "When sending a message", ->
@ -197,7 +197,7 @@ describe "ComposerView", ->
body: pristineBody
makeComposer.call(@)
spyOn(@proxy, 'draftPristineBody').andCallFake -> pristineBody
spyOn(@session, 'draftPristineBody').andCallFake -> pristineBody
status = @composer._isValidDraft()
expect(status).toBe false

View file

@ -58,10 +58,10 @@ describe "Composer Quoted Text", ->
it "allows the text to update", ->
textToAdd = "MORE <strong>TEXT</strong>!"
spyOn(@composer, "_addToProxy")
spyOn(@composer, "_applyChanges")
expect(@$contentEditable.innerHTML).toBe @htmlNoQuote
setHTML.call(@, textToAdd + @htmlNoQuote)
ev = @composer._addToProxy.mostRecentCall.args[0].body
ev = @composer._applyChanges.mostRecentCall.args[0].body
expect(ev).toEqual(textToAdd + @htmlNoQuote)
it 'should not render the quoted-text-control toggle', ->
@ -84,20 +84,20 @@ describe "Composer Quoted Text", ->
it 'should display the quoted text', ->
expect(@$contentEditable.innerHTML).toBe @htmlWithQuote
it "should call `_addToProxy` with the entire HTML string", ->
it "should call `_applyChanges` with the entire HTML string", ->
textToAdd = "MORE <strong>TEXT</strong>!"
spyOn(@composer, "_addToProxy")
spyOn(@composer, "_applyChanges")
expect(@$contentEditable.innerHTML).toBe @htmlWithQuote
setHTML.call(@, textToAdd + @htmlWithQuote)
ev = @composer._addToProxy.mostRecentCall.args[0].body
ev = @composer._applyChanges.mostRecentCall.args[0].body
expect(ev).toEqual(textToAdd + @htmlWithQuote)
it "should allow the quoted text to be changed", ->
newText = 'Test <strong>NEW 1 HTML</strong><blockquote class="gmail_quote">QUOTE CHANGED!!!</blockquote>'
spyOn(@composer, "_addToProxy")
spyOn(@composer, "_applyChanges")
expect(@$contentEditable.innerHTML).toBe @htmlWithQuote
setHTML.call(@, newText)
ev = @composer._addToProxy.mostRecentCall.args[0].body
ev = @composer._applyChanges.mostRecentCall.args[0].body
expect(ev).toEqual(newText)
describe 'quoted text control toggle button', ->
@ -125,22 +125,22 @@ describe "Composer Quoted Text", ->
it 'should not display any quoted text', ->
expect(@$contentEditable.innerHTML).toBe @htmlNoQuote
it "should let you change the text, and then append the quoted text part to the end before firing `_addToProxy`", ->
it "should let you change the text, and then append the quoted text part to the end before firing `_applyChanges`", ->
textToAdd = "MORE <strong>TEXT</strong>!"
spyOn(@composer, "_addToProxy")
spyOn(@composer, "_applyChanges")
expect(@$contentEditable.innerHTML).toBe @htmlNoQuote
setHTML.call(@, textToAdd + @htmlNoQuote)
ev = @composer._addToProxy.mostRecentCall.args[0].body
ev = @composer._applyChanges.mostRecentCall.args[0].body
# Note that we expect the version WITH a quote while setting the
# version withOUT a quote.
expect(ev).toEqual(wrapBody(textToAdd + @htmlWithQuote))
it "should let you add more html that looks like quoted text, and still properly appends the old quoted text", ->
textToAdd = "Yo <blockquote class=\"gmail_quote\">I'm a fake quote</blockquote>"
spyOn(@composer, "_addToProxy")
spyOn(@composer, "_applyChanges")
expect(@$contentEditable.innerHTML).toBe @htmlNoQuote
setHTML.call(@, textToAdd + @htmlNoQuote)
ev = @composer._addToProxy.mostRecentCall.args[0].body
ev = @composer._applyChanges.mostRecentCall.args[0].body
# Note that we expect the version WITH a quote while setting the
# version withOUT a quote.
expect(ev).toEqual(wrapBody(textToAdd + @htmlWithQuote))

View file

@ -2,8 +2,8 @@ Message = require '../../src/flux/models/message'
Actions = require '../../src/flux/actions'
DatabaseStore = require '../../src/flux/stores/database-store'
DatabaseTransaction = require '../../src/flux/stores/database-transaction'
DraftStoreProxy = require '../../src/flux/stores/draft-store-proxy'
DraftChangeSet = DraftStoreProxy.DraftChangeSet
DraftEditingSession = require '../../src/flux/stores/draft-editing-session'
DraftChangeSet = DraftEditingSession.DraftChangeSet
_ = require 'underscore'
describe "DraftChangeSet", ->
@ -99,60 +99,60 @@ describe "DraftChangeSet", ->
expect(m.subject).toEqual('A')
expect(m.body).toEqual('Basketball')
describe "DraftStoreProxy", ->
describe "DraftEditingSession", ->
describe "constructor", ->
it "should make a query to fetch the draft", ->
spyOn(DatabaseStore, 'run').andCallFake =>
new Promise (resolve, reject) =>
proxy = new DraftStoreProxy('client-id')
session = new DraftEditingSession('client-id')
expect(DatabaseStore.run).toHaveBeenCalled()
describe "when given a draft object", ->
beforeEach ->
spyOn(DatabaseStore, 'run')
@draft = new Message(draft: true, body: '123')
@proxy = new DraftStoreProxy('client-id', @draft)
@session = new DraftEditingSession('client-id', @draft)
it "should not make a query for the draft", ->
expect(DatabaseStore.run).not.toHaveBeenCalled()
it "prepare should resolve without querying for the draft", ->
waitsForPromise => @proxy.prepare().then =>
expect(@proxy.draft()).toBeDefined()
waitsForPromise => @session.prepare().then =>
expect(@session.draft()).toBeDefined()
expect(DatabaseStore.run).not.toHaveBeenCalled()
describe "teardown", ->
it "should mark the session as destroyed", ->
spyOn(DraftStoreProxy.prototype, "prepare")
proxy = new DraftStoreProxy('client-id')
proxy.teardown()
expect(proxy._destroyed).toEqual(true)
spyOn(DraftEditingSession.prototype, "prepare")
session = new DraftEditingSession('client-id')
session.teardown()
expect(session._destroyed).toEqual(true)
describe "prepare", ->
beforeEach ->
@draft = new Message(draft: true, body: '123', clientId: 'client-id')
spyOn(DraftStoreProxy.prototype, "prepare")
@proxy = new DraftStoreProxy('client-id')
spyOn(@proxy, '_setDraft').andCallThrough()
spyOn(DraftEditingSession.prototype, "prepare")
@session = new DraftEditingSession('client-id')
spyOn(@session, '_setDraft').andCallThrough()
spyOn(DatabaseStore, 'run').andCallFake (modelQuery) =>
Promise.resolve(@draft)
jasmine.unspy(DraftStoreProxy.prototype, "prepare")
jasmine.unspy(DraftEditingSession.prototype, "prepare")
it "should call setDraft with the retrieved draft", ->
waitsForPromise =>
@proxy.prepare().then =>
expect(@proxy._setDraft).toHaveBeenCalledWith(@draft)
@session.prepare().then =>
expect(@session._setDraft).toHaveBeenCalledWith(@draft)
it "should resolve with the DraftStoreProxy", ->
it "should resolve with the DraftEditingSession", ->
waitsForPromise =>
@proxy.prepare().then (val) =>
expect(val).toBe(@proxy)
@session.prepare().then (val) =>
expect(val).toBe(@session)
describe "error handling", ->
it "should reject if the draft session has already been destroyed", ->
@proxy._destroyed = true
@session._destroyed = true
waitsForPromise =>
@proxy.prepare().then =>
@session.prepare().then =>
expect(false).toBe(true)
.catch (val) =>
expect(val instanceof Error).toBe(true)
@ -160,7 +160,7 @@ describe "DraftStoreProxy", ->
it "should reject if the draft cannot be found", ->
@draft = null
waitsForPromise =>
@proxy.prepare().then =>
@session.prepare().then =>
expect(false).toBe(true)
.catch (val) =>
expect(val instanceof Error).toBe(true)
@ -168,40 +168,40 @@ describe "DraftStoreProxy", ->
describe "when a draft changes", ->
beforeEach ->
@draft = new Message(draft: true, clientId: 'client-id', body: 'A', subject: 'initial')
@proxy = new DraftStoreProxy('client-id', @draft)
@session = new DraftEditingSession('client-id', @draft)
advanceClock()
spyOn(DatabaseTransaction.prototype, "persistModel").andReturn Promise.resolve()
spyOn(Actions, "queueTask").andReturn Promise.resolve()
it "should ignore the update unless it applies to the current draft", ->
spyOn(@proxy, 'trigger')
@proxy._onDraftChanged(objectClass: 'message', objects: [new Message()])
expect(@proxy.trigger).not.toHaveBeenCalled()
@proxy._onDraftChanged(objectClass: 'message', objects: [@draft])
expect(@proxy.trigger).toHaveBeenCalled()
spyOn(@session, 'trigger')
@session._onDraftChanged(objectClass: 'message', objects: [new Message()])
expect(@session.trigger).not.toHaveBeenCalled()
@session._onDraftChanged(objectClass: 'message', objects: [@draft])
expect(@session.trigger).toHaveBeenCalled()
it "should apply the update to the current draft", ->
updatedDraft = @draft.clone()
updatedDraft.subject = 'This is the new subject'
@proxy._onDraftChanged(objectClass: 'message', objects: [updatedDraft])
expect(@proxy.draft().subject).toEqual(updatedDraft.subject)
@session._onDraftChanged(objectClass: 'message', objects: [updatedDraft])
expect(@session.draft().subject).toEqual(updatedDraft.subject)
it "atomically commits changes", ->
spyOn(DatabaseStore, "run").andReturn(Promise.resolve(@draft))
spyOn(DatabaseStore, 'inTransaction').andCallThrough()
@proxy.changes.add({body: "123"})
@session.changes.add({body: "123"})
waitsForPromise =>
@proxy.changes.commit().then =>
@session.changes.commit().then =>
expect(DatabaseStore.inTransaction).toHaveBeenCalled()
expect(DatabaseStore.inTransaction.calls.length).toBe 1
it "persist the applied changes", ->
spyOn(DatabaseStore, "run").andReturn(Promise.resolve(@draft))
@proxy.changes.add({body: "123"})
@session.changes.add({body: "123"})
waitsForPromise =>
@proxy.changes.commit().then =>
@session.changes.commit().then =>
expect(DatabaseTransaction.prototype.persistModel).toHaveBeenCalled()
updated = DatabaseTransaction.prototype.persistModel.calls[0].args[0]
expect(updated.body).toBe "123"
@ -210,9 +210,9 @@ describe "DraftStoreProxy", ->
#
# it "queues a SyncbackDraftTask", ->
# spyOn(DatabaseStore, "run").andReturn(Promise.resolve(@draft))
# @proxy.changes.add({body: "123"})
# @session.changes.add({body: "123"})
# waitsForPromise =>
# @proxy.changes.commit().then =>
# @session.changes.commit().then =>
# expect(Actions.queueTask).toHaveBeenCalled()
# task = Actions.queueTask.calls[0].args[0]
# expect(task.draftClientId).toBe "client-id"
@ -220,15 +220,15 @@ describe "DraftStoreProxy", ->
it "doesn't queues a SyncbackDraftTask if no Syncback is passed", ->
spyOn(DatabaseStore, "run").andReturn(Promise.resolve(@draft))
waitsForPromise =>
@proxy.changes.commit({noSyncback: true}).then =>
@session.changes.commit({noSyncback: true}).then =>
expect(Actions.queueTask).not.toHaveBeenCalled()
describe "when findBy does not return a draft", ->
it "continues and persists it's local draft reference, so it is resaved and draft editing can continue", ->
spyOn(DatabaseStore, "run").andReturn(Promise.resolve(null))
@proxy.changes.add({body: "123"})
@session.changes.add({body: "123"})
waitsForPromise =>
@proxy.changes.commit().then =>
@session.changes.commit().then =>
expect(DatabaseTransaction.prototype.persistModel).toHaveBeenCalled()
updated = DatabaseTransaction.prototype.persistModel.calls[0].args[0]
expect(updated.body).toBe "123"
@ -237,9 +237,9 @@ describe "DraftStoreProxy", ->
spyOn(DatabaseStore, "run").andReturn(Promise.resolve(@draft))
spyOn(DatabaseStore, 'inTransaction').andCallThrough()
waitsForPromise =>
@proxy._destroyed = true
@proxy.changes.add({body: "123"})
@proxy.changes.commit().then =>
@session._destroyed = true
@session.changes.add({body: "123"})
@session.changes.commit().then =>
expect(DatabaseStore.inTransaction).not.toHaveBeenCalled()
describe "draft pristine body", ->
@ -250,12 +250,12 @@ describe "DraftStoreProxy", ->
updatedDraft.body = '123444'
updatedDraft.pristine = false
@proxy = new DraftStoreProxy('client-id', pristineDraft)
@proxy._onDraftChanged(objectClass: 'message', objects: [updatedDraft])
expect(@proxy.draftPristineBody()).toBe('Hiya')
@session = new DraftEditingSession('client-id', pristineDraft)
@session._onDraftChanged(objectClass: 'message', objects: [updatedDraft])
expect(@session.draftPristineBody()).toBe('Hiya')
describe "when the draft given to the session is not pristine", ->
it "should return null", ->
dirtyDraft = new Message(draft: true, body: 'Hiya', pristine: false)
@proxy = new DraftStoreProxy('client-id', dirtyDraft)
expect(@proxy.draftPristineBody()).toBe(null)
@session = new DraftEditingSession('client-id', dirtyDraft)
expect(@session.draftPristineBody()).toBe(null)

View file

@ -298,9 +298,9 @@ describe("DraftStore", () => {
DraftStore._draftSessions = {};
DraftStore._draftsSending = {};
this.forceCommit = false;
const proxy = {
const session = {
prepare() {
return Promise.resolve(proxy);
return Promise.resolve(session);
},
teardown() {},
draft: () => this.draft,
@ -312,7 +312,7 @@ describe("DraftStore", () => {
},
};
DraftStore._draftSessions[this.draft.clientId] = proxy;
DraftStore._draftSessions[this.draft.clientId] = session;
spyOn(DraftStore, "_doneWithSession").andCallThrough();
spyOn(DraftStore, "_prepareForSyncback").andReturn(Promise.resolve());
spyOn(DraftStore, "trigger");

View file

@ -13,14 +13,14 @@ MetadataChangePrefix = 'metadata.'
###
Public: As the user interacts with the draft, changes are accumulated in the
DraftChangeSet associated with the store proxy. The DraftChangeSet does two things:
DraftChangeSet associated with the store session. The DraftChangeSet does two things:
1. It debounces changes and calls Actions.saveDraft() at a reasonable interval.
2. It exposes `applyToModel`, which allows you to optimistically apply changes
to a draft object. When the proxy vends the draft, it passes it through this
to a draft object. When the session vends the draft, it passes it through this
function to apply uncommitted changes. This means the Draft provided by the
DraftStoreProxy will always relfect recent changes, even though they're
DraftEditingSession will always relfect recent changes, even though they're
written to the database intermittently.
Section: Drafts
@ -75,7 +75,7 @@ class DraftChangeSet
model
###
Public: DraftStoreProxy is a small class that makes it easy to implement components
Public: DraftEditingSession is a small class that makes it easy to implement components
that display Draft objects or allow for interactive editing of Drafts.
1. It synchronously provides an instance of a draft via `draft()`, and
@ -87,7 +87,7 @@ that display Draft objects or allow for interactive editing of Drafts.
Section: Drafts
###
class DraftStoreProxy
class DraftEditingSession
@include: CoffeeHelpers.includeModule
@include Publisher
@ -135,7 +135,7 @@ class DraftStoreProxy
_setDraft: (draft) ->
if !draft.body?
throw new Error("DraftStoreProxy._setDraft - new draft has no body!")
throw new Error("DraftEditingSession._setDraft - new draft has no body!")
# We keep track of the draft's initial body if it's pristine when the editing
# session begins. This initial value powers things like "are you sure you want
@ -208,6 +208,6 @@ class DraftStoreProxy
Actions.ensureDraftSynced(@draftClientId)
DraftStoreProxy.DraftChangeSet = DraftChangeSet
DraftEditingSession.DraftChangeSet = DraftChangeSet
module.exports = DraftStoreProxy
module.exports = DraftEditingSession

View file

@ -3,7 +3,7 @@ _ = require 'underscore'
{ipcRenderer} = require 'electron'
NylasAPI = require '../nylas-api'
DraftStoreProxy = require './draft-store-proxy'
DraftEditingSession = require './draft-editing-session'
DraftFactory = require './draft-factory'
DatabaseStore = require './database-store'
AccountStore = require './account-store'
@ -95,7 +95,7 @@ class DraftStore
######### PUBLIC #######################################################
# Public: Fetch a {DraftStoreProxy} for displaying and/or editing the
# Public: Fetch a {DraftEditingSession} for displaying and/or editing the
# draft with `clientId`.
#
# Example:
@ -108,7 +108,7 @@ class DraftStore
#
# - `clientId` The {String} clientId of the draft.
#
# Returns a {Promise} that resolves to an {DraftStoreProxy} for the
# Returns a {Promise} that resolves to an {DraftEditingSession} for the
# draft once it has been prepared:
sessionForClientId: (clientId) =>
if not clientId
@ -259,7 +259,7 @@ class DraftStore
.thenReturn({draftClientId: draft.clientId, draft: draft})
_createSession: (clientId, draft) =>
@_draftSessions[clientId] = new DraftStoreProxy(clientId, draft)
@_draftSessions[clientId] = new DraftEditingSession(clientId, draft)
_onPopoutBlankDraft: =>
DraftFactory.createDraft().then (draft) =>

View file

@ -38,7 +38,7 @@ export default class BaseDraftTask extends Task {
performLocal() {
// SyncbackDraftTask does not do anything locally. You should persist your changes
// to the local database directly or using a DraftStoreProxy, and then queue a
// to the local database directly or using a DraftEditingSession, and then queue a
// SyncbackDraftTask to send those changes to the server.
if (!this.draftClientId) {
const errMsg = `Attempt to call ${this.constructor.name}.performLocal without a draftClientId`;