diff --git a/src/static/js/chat.js b/src/static/js/chat.js index 2df78b614..7ec3abdf0 100755 --- a/src/static/js/chat.js +++ b/src/static/js/chat.js @@ -105,7 +105,7 @@ exports.chat = (() => { this._pad.collabClient.sendMessage({type: 'CHAT_MESSAGE', text}); $('#chatinput').val(''); }, - addMessage(msg, increment, isHistoryAdd) { + async addMessage(msg, increment, isHistoryAdd) { // correct the time msg.time += this._pad.clientTimeOffset; @@ -161,49 +161,47 @@ exports.chat = (() => { ctx.sticky = true; } - // Call chat message hook - hooks.aCallAll('chatNewMessage', ctx, () => { - const cls = authorClass(ctx.author); - const chatMsg = $('
')
- .attr('data-authorId', ctx.author)
- .addClass(cls)
- .append($('').text(`${ctx.authorName}:`))
- .append($('')
- .addClass('time')
- .addClass(cls)
- // Hook functions are trusted to not introduce an XSS vulnerability by adding
- // unescaped user input to ctx.timeStr.
- .html(ctx.timeStr))
- .append(' ')
- // ctx.text was HTML-escaped before calling the hook. Hook functions are trusted to not
- // introduce an XSS vulnerability by adding unescaped user input.
- .append($(' ')
+ .attr('data-authorId', ctx.author)
+ .addClass(cls)
+ .append($('').text(`${ctx.authorName}:`))
+ .append($('')
+ .addClass('time')
+ .addClass(cls)
+ // Hook functions are trusted to not introduce an XSS vulnerability by adding
+ // unescaped user input to ctx.timeStr.
+ .html(ctx.timeStr))
+ .append(' ')
+ // ctx.text was HTML-escaped before calling the hook. Hook functions are trusted to not
+ // introduce an XSS vulnerability by adding unescaped user input.
+ .append($(' ')
- .append($('').addClass('author-name').text(ctx.authorName))
- // ctx.text was HTML-escaped before calling the hook. Hook functions are trusted
- // to not introduce an XSS vulnerability by adding unescaped user input.
- .append($(' ')
+ .append($('').addClass('author-name').text(ctx.authorName))
+ // ctx.text was HTML-escaped before calling the hook. Hook functions are trusted
+ // to not introduce an XSS vulnerability by adding unescaped user input.
+ .append($('