Skip to content

Commit

Permalink
Merge pull request #263 from smooch/integration
Browse files Browse the repository at this point in the history
Release 2.6.3
  • Loading branch information
lemieux committed May 26, 2016
2 parents 597cb54 + 057f568 commit efc4fb0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
2 changes: 2 additions & 0 deletions release_notes/v2.6.3.md
@@ -0,0 +1,2 @@
# Fixes
- This release fixes another regression introduced in 2.6.2. We are very sorry for the trouble.
25 changes: 18 additions & 7 deletions src/js/services/conversation-service.js
Expand Up @@ -58,15 +58,17 @@ export function sendMessage(text) {

return core().conversations.sendMessage(user._id, message).then((response) => {
if (!user.conversationStarted) {
// use setConversation to set the conversation id in the store
store.dispatch(setConversation(response.conversation));
store.dispatch(updateUser({
conversationStarted: true
}));
} else {
store.dispatch(replaceMessage({
_clientId: message._clientId
}, response.message));
}

store.dispatch(replaceMessage({
_clientId: message._clientId
}, response.message));

observable.trigger('message:sent', response.message);
return response;
});
Expand Down Expand Up @@ -100,9 +102,18 @@ export function uploadImage(file) {
role: 'appUser',
deviceId: getDeviceId()
}).then((response) => {
store.dispatch(replaceMessage({
_clientId: message._clientId
}, response.message));
if (!user.conversationStarted) {
// use setConversation to set the conversation id in the store
store.dispatch(setConversation(response.conversation));
store.dispatch(updateUser({
conversationStarted: true
}));
} else {
store.dispatch(replaceMessage({
_clientId: message._clientId
}, response.message));
}

observable.trigger('message:sent', response.message);
return response;
}).catch(() => {
Expand Down

0 comments on commit efc4fb0

Please sign in to comment.