diff --git a/src/lib/markdown.ts b/src/lib/markdown.ts index 84e8a32..e4d2044 100644 --- a/src/lib/markdown.ts +++ b/src/lib/markdown.ts @@ -5,7 +5,9 @@ const mdEmoji = require("markdown-it-emoji"); namespace markdown { - const md = new MarkdownIt() + const md = new MarkdownIt({ + linkify: true, + }) .use(html5Media) .use(mdEmoji); diff --git a/src/routes/HomeRoute.ts b/src/routes/HomeRoute.ts index 1fafe4b..97cc980 100644 --- a/src/routes/HomeRoute.ts +++ b/src/routes/HomeRoute.ts @@ -47,6 +47,12 @@ class HomeRoute extends Route { globals.internalEmitter.on(InternalEvents.GQLPOSTCREATE, async (post: Post) => { socket.emit("post", Object.assign(post, {htmlContent: post.htmlContent})); }); + globals.internalEmitter.on(InternalEvents.CHATCREATE, async (chat: ChatRoom) => { + const user = await User.findByPk(socket.handshake.session.userId); + if (await chat.$has("rMembers", user)) { + socket.emit("chatCreate", chat); + } + }); }); const chats = await dataaccess.getAllChats();