Skip to content

Commit

Permalink
Create htreading-messages despite no-sys-messages (RocketChat#534)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsimpson authored and ThomasRoehl committed Sep 25, 2018
1 parent 1305288 commit 33f5a41
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/assistify-threading/server/methods/createThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,18 @@ export class ThreadBuilder {

linkMessage.urls = [{url: this._getMessageUrl(repostedMessage._id)}];

return RocketChat.models.Messages.createWithTypeRoomIdMessageAndUser('create-thread', parentRoom._id, this._getMessageUrl(repostedMessage._id), this.rocketCatUser, linkMessage, {ts: this._openingQuestion.ts});
// we want to create a system message for linking the thread from the parent room - so the parent room
// has to support system messages at least for this interaction
if (!parentRoom.sysMes) {
RocketChat.models.Rooms.setSystemMessagesById(parentRoom._id, true);
}
RocketChat.models.Messages.createWithTypeRoomIdMessageAndUser('create-thread', parentRoom._id, this._getMessageUrl(repostedMessage._id), this.rocketCatUser, linkMessage, {ts: this._openingQuestion.ts});

// reset it if necessary
if (!parentRoom.sysMes) {
RocketChat.models.Rooms.setSystemMessagesById(parentRoom._id, false);
}
return true;
}
}

Expand Down

0 comments on commit 33f5a41

Please sign in to comment.