Skip to content

Commit

Permalink
fix duplicated room creation on new room
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasRoehl committed Jun 13, 2018
1 parent 3a43bba commit dcfa1e0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/assistify-ai/server/lib/SmartiAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export class SmartiAdapter {
static afterCreateChannel(rid) {
const room = RocketChat.models.Rooms.findOneById(rid);
SystemLogger.debug('Room created: ', room);
SmartiAdapter._createAndPostConversation(room);
const conversationId = SmartiAdapter._createAndPostConversation(room).id;
SmartiAdapter._updateMapping(rid, conversationId);
}

/**
Expand Down Expand Up @@ -92,12 +93,12 @@ export class SmartiAdapter {

if (request_result) {
Meteor.defer(() => SmartiAdapter._markMessageAsSynced(message._id));
SmartiAdapter._getAnalysisResult(message.rid, conversationId);
Meteor.defer(() => SmartiAdapter._tryResync(message.rid, false));
} else {
// if the message could not be synced this time, re-synch the complete room next time
Meteor.defer(() => SmartiAdapter._markRoomAsUnsynced(message.rid));
}
SmartiAdapter._getAnalysisResult(message.rid, conversationId);
}

/**
Expand Down

0 comments on commit dcfa1e0

Please sign in to comment.