mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	show max message length in error message
This commit is contained in:
		| @@ -129,7 +129,7 @@ | ||||
| 	"chat-disabled": "Chat system disabled", | ||||
| 	"too-many-messages": "You have sent too many messages, please wait awhile.", | ||||
| 	"invalid-chat-message": "Invalid chat message", | ||||
| 	"chat-message-too-long": "Chat message is too long", | ||||
| 	"chat-message-too-long": "Chat messages can not be longer than %1 characters.", | ||||
| 	"cant-edit-chat-message": "You are not allowed to edit this message", | ||||
| 	"cant-remove-last-user": "You can't remove the last user", | ||||
| 	"cant-delete-chat-message": "You are not allowed to delete this message", | ||||
|   | ||||
| @@ -9,7 +9,7 @@ define('forum/chats/messages', ['components', 'sounds', 'translator'], function | ||||
| 		var mid = inputEl.attr('data-mid'); | ||||
|  | ||||
| 		if (msg.length > ajaxify.data.maximumChatMessageLength) { | ||||
| 			return app.alertError('[[error:chat-message-too-long]]'); | ||||
| 			return app.alertError('[[error:chat-message-too-long,' + ajaxify.data.maximumChatMessageLength + ']]'); | ||||
| 		} | ||||
|  | ||||
| 		if (!msg.length) { | ||||
|   | ||||
| @@ -30,9 +30,11 @@ module.exports = function (Messaging) { | ||||
| 		if (!content) { | ||||
| 			return callback(new Error('[[error:invalid-chat-message]]')); | ||||
| 		} | ||||
| 		content = String(content); | ||||
|  | ||||
| 		if (content.length > (meta.config.maximumChatMessageLength || 1000)) { | ||||
| 			return callback(new Error('[[error:chat-message-too-long]]')); | ||||
| 		var maximumChatMessageLength = (meta.config.maximumChatMessageLength || 1000); | ||||
| 		if (content.length > maximumChatMessageLength) { | ||||
| 			return callback(new Error('[[error:chat-message-too-long, ' + maximumChatMessageLength + ']]')); | ||||
| 		} | ||||
| 		callback(); | ||||
| 	}; | ||||
| @@ -52,7 +54,7 @@ module.exports = function (Messaging) { | ||||
| 			function (_mid, next) { | ||||
| 				mid = _mid; | ||||
| 				message = { | ||||
| 					content: content, | ||||
| 					content: String(content), | ||||
| 					timestamp: timestamp, | ||||
| 					fromuid: fromuid, | ||||
| 					roomId: roomId, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user