fix(account): change default user for data import

This commit is contained in:
Evan Morikawa 2015-10-04 16:33:47 -07:00
parent 71edc1ad1d
commit 10ed936c22

View file

@ -117,13 +117,13 @@ class AccountStore
threads = [] threads = []
messages = [] messages = []
account = @itemWithEmailAddress('mark@nylas.com') account = @itemWithEmailAddress('nora@nylas.com')
unless account unless account
account = new Account() account = new Account()
account.serverId = account.clientId account.serverId = account.clientId
account.emailAddress = "mark@nylas.com" account.emailAddress = "nora@nylas.com"
account.organizationUnit = 'label' account.organizationUnit = 'label'
account.name = "Mark" account.name = "Nora"
account.provider = "gmail" account.provider = "gmail"
@_accounts.push(account) @_accounts.push(account)
@_tokens[account.id] = 'nope' @_tokens[account.id] = 'nope'
@ -151,18 +151,19 @@ class AccountStore
threadParticipants = _.uniq threadParticipants, (p) -> p.email threadParticipants = _.uniq threadParticipants, (p) -> p.email
threadLabels = _.uniq threadLabels, (l) -> l.id threadLabels = _.uniq threadLabels, (l) -> l.id
lastMsg = _.last(threadMessages)
thread = new Thread( thread = new Thread(
accountId: account.id accountId: account.id
serverId: threadMessages[0].threadId serverId: lastMsg.threadId
clientId: threadMessages[0].threadId clientId: lastMsg.threadId
subject: threadMessages[0].subject subject: lastMsg.subject
lastMessageReceivedTimestamp: threadMessages[0].date lastMessageReceivedTimestamp: lastMsg.date
hasAttachment: threadAttachment hasAttachment: threadAttachment
labels: threadLabels labels: threadLabels
participants: threadParticipants participants: threadParticipants
unread: threadUnread unread: threadUnread
snippet: threadMessages[0].snippet snippet: lastMsg.snippet
starred: threadMessages[0].starred starred: lastMsg.starred
) )
messages = messages.concat(threadMessages) messages = messages.concat(threadMessages)
threads.push(thread) threads.push(thread)