Skip to content

Node.js based forum software built for the modern web

closes #4299

barisusaklia67f3d2a1594
diff --git a/public/src/client/chats.js b/public/src/client/chats.js
index 21da307713..280123d4c0 100644
--- a/public/src/client/chats.js
+++ b/public/src/client/chats.js
@@ -376,7 +376,7 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
Chats.onChatEdit();
socket.on('event:chats.roomRename', function(data) {
- $('[component="chat/room/name"]').val(data.newName);
+ $('[component="chat/room/name"]').val($('<div/>').html(data.newName).text());
});
};
diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js
index 7721b6e70a..5fd69083da 100644
--- a/public/src/modules/chat.js
+++ b/public/src/modules/chat.js
@@ -71,7 +71,7 @@ define('chat', ['components', 'taskbar', 'string', 'sounds', 'forum/chats', 'tra
});
socket.on('event:chats.roomRename', function(data) {
- module.getModal(data.roomId).find('[component="chat/room/name"]').val(data.newName);
+ module.getModal(data.roomId).find('[component="chat/room/name"]').val($('<div/>').html(data.newName).text());
});
Chats.onChatEdit();
diff --git a/src/messaging/rooms.js b/src/messaging/rooms.js
index 784c6cb2c0..0c9c5bb01f 100644
--- a/src/messaging/rooms.js
+++ b/src/messaging/rooms.js
@@ -147,7 +147,10 @@ module.exports = function(Messaging) {
if (!newName) {
return callback(new Error('[[error:invalid-name]]'));
}
-
+ newName = newName.trim();
+ if (newName.length > 75) {
+ return callback(new Error('[[error:chat-room-name-too-long]]'));
+ }
async.waterfall([
function (next) {
Messaging.isRoomOwner(uid, roomId, next);