Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update conversation bug fix #65

Merged
merged 2 commits into from Aug 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions demo/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,15 @@ var SkygearChatContainer = exports.SkygearChatContainer = function () {
}, {
key: 'updateConversation',
value: function updateConversation(conversation, title, meta) {
var newConversation = new Conversation();
newConversation._id = conversation._id;
if (title) {
conversation.title = title;
newConversation.title = title;
}
if (meta) {
conversation.meta = meta;
newConversation.meta = meta;
}
return _skygear2.default.publicDB.save(conversation);
return _skygear2.default.publicDB.save(newConversation);
}

/**
Expand Down Expand Up @@ -527,7 +529,7 @@ var SkygearChatContainer = exports.SkygearChatContainer = function () {
* @param {number} [limit=50] - limit the result set, if it is set to too large, may
* result in timeout.
* @param {Date} beforeTime - specific from which time
* @param {string} order - order of the message, '_edited_at' or '_created_at'
* @param {string} order - order of the message, 'edited_at' or '_created_at'
* @return {Promise<[]Message>} - array of Message records
*/

Expand Down
8 changes: 5 additions & 3 deletions lib/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,15 @@ export class SkygearChatContainer {
* @return {Promise<Conversation>} - A promise to save result
*/
updateConversation(conversation, title, meta) {
let newConversation = new Conversation();
newConversation._id = conversation._id;
if (title) {
conversation.title = title;
newConversation.title = title;
}
if (meta) {
conversation.meta = meta;
newConversation.meta = meta;
}
return skygear.publicDB.save(conversation);
return skygear.publicDB.save(newConversation);
}

/**
Expand Down