From 5c3155f145f28a1b4d6bbe9f4412516c8dca1970 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 26 Jan 2018 13:22:11 -0500 Subject: [PATCH] firing hook on chat message load and exposing upload_url to client-side --- public/src/client/chats/messages.js | 4 ++++ src/controllers/api.js | 1 + 2 files changed, 5 insertions(+) diff --git a/public/src/client/chats/messages.js b/public/src/client/chats/messages.js index cfbcacf8f8..6a772dd6e5 100644 --- a/public/src/client/chats/messages.js +++ b/public/src/client/chats/messages.js @@ -82,6 +82,10 @@ define('forum/chats/messages', ['components', 'sounds', 'translator', 'benchpres newMessage.find('.timeago').timeago(); newMessage.find('img:not(.not-responsive)').addClass('img-responsive'); messages.scrollToBottom(chatContentEl); + + $(window).trigger('action:chat.received', { + messageEl: newMessage, + }); } diff --git a/src/controllers/api.js b/src/controllers/api.js index a9e3dacf79..790029694f 100644 --- a/src/controllers/api.js +++ b/src/controllers/api.js @@ -18,6 +18,7 @@ var apiController = module.exports; apiController.loadConfig = function (req, callback) { var config = {}; config.relative_path = nconf.get('relative_path'); + config.upload_url = nconf.get('upload_url'); config.siteTitle = validator.escape(String(meta.config.title || meta.config.browserTitle || 'NodeBB')); config.browserTitle = validator.escape(String(meta.config.browserTitle || meta.config.title || 'NodeBB')); config.titleLayout = (meta.config.titleLayout || '{pageTitle} | {browserTitle}').replace(/{/g, '{').replace(/}/g, '}');