diff --git a/dump.rdb b/dump.rdb new file mode 100644 index 0000000000..c4d2287aad Binary files /dev/null and b/dump.rdb differ diff --git a/public/src/client/register.js b/public/src/client/register.js index d8144d26d5..23e7e7cfe6 100644 --- a/public/src/client/register.js +++ b/public/src/client/register.js @@ -135,7 +135,7 @@ define('forum/register', [ if (results.every(obj => obj.status === 'rejected')) { showSuccess(usernameInput, username_notify, successIcon); } else { - showError(usernameInput, username_notify, '[[error:username-taken]]'); + showError(usernameInput, username_notify, 'Username taken. Try 1234' + username); } callback(); diff --git a/src/socket.io/index.js b/src/socket.io/index.js index 43804c22d3..f0075c7f40 100644 --- a/src/socket.io/index.js +++ b/src/socket.io/index.js @@ -20,6 +20,7 @@ const apiHelpers = require('../api/helpers'); const Namespaces = Object.create(null); const Sockets = module.exports; +const SocketPlugins = {}; Sockets.init = async function (server) { requireModules(); @@ -336,3 +337,14 @@ Sockets.warnDeprecated = (socket, replacement) => { ` ${replacement ? `use ${replacement}` : 'there is no replacement for this call.'}`, ].join('\n')); }; + +SocketPlugins.chat = { + messageRead: function (socket, data, callback) { + const { messageId, userId } = data; + db.collection('messages').update( + { _id: messageId }, + { $addToSet: { readBy: userId } } + ); + callback(null, true); + }, +}; diff --git a/src/views/partials/chats/message.tpl b/src/views/partials/chats/message.tpl index 527a055f17..f18e23091f 100644 --- a/src/views/partials/chats/message.tpl +++ b/src/views/partials/chats/message.tpl @@ -15,8 +15,12 @@ {{{ end }}} -
+ + + +
+
{messages.content} @@ -73,4 +77,42 @@
- \ No newline at end of file + + + \ No newline at end of file