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", | 	"chat-disabled": "Chat system disabled", | ||||||
| 	"too-many-messages": "You have sent too many messages, please wait awhile.", | 	"too-many-messages": "You have sent too many messages, please wait awhile.", | ||||||
| 	"invalid-chat-message": "Invalid chat message", | 	"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-edit-chat-message": "You are not allowed to edit this message", | ||||||
| 	"cant-remove-last-user": "You can't remove the last user", | 	"cant-remove-last-user": "You can't remove the last user", | ||||||
| 	"cant-delete-chat-message": "You are not allowed to delete this message", | 	"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'); | 		var mid = inputEl.attr('data-mid'); | ||||||
|  |  | ||||||
| 		if (msg.length > ajaxify.data.maximumChatMessageLength) { | 		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) { | 		if (!msg.length) { | ||||||
|   | |||||||
| @@ -30,9 +30,11 @@ module.exports = function (Messaging) { | |||||||
| 		if (!content) { | 		if (!content) { | ||||||
| 			return callback(new Error('[[error:invalid-chat-message]]')); | 			return callback(new Error('[[error:invalid-chat-message]]')); | ||||||
| 		} | 		} | ||||||
|  | 		content = String(content); | ||||||
|  |  | ||||||
| 		if (content.length > (meta.config.maximumChatMessageLength || 1000)) { | 		var maximumChatMessageLength = (meta.config.maximumChatMessageLength || 1000); | ||||||
| 			return callback(new Error('[[error:chat-message-too-long]]')); | 		if (content.length > maximumChatMessageLength) { | ||||||
|  | 			return callback(new Error('[[error:chat-message-too-long, ' + maximumChatMessageLength + ']]')); | ||||||
| 		} | 		} | ||||||
| 		callback(); | 		callback(); | ||||||
| 	}; | 	}; | ||||||
| @@ -52,7 +54,7 @@ module.exports = function (Messaging) { | |||||||
| 			function (_mid, next) { | 			function (_mid, next) { | ||||||
| 				mid = _mid; | 				mid = _mid; | ||||||
| 				message = { | 				message = { | ||||||
| 					content: content, | 					content: String(content), | ||||||
| 					timestamp: timestamp, | 					timestamp: timestamp, | ||||||
| 					fromuid: fromuid, | 					fromuid: fromuid, | ||||||
| 					roomId: roomId, | 					roomId: roomId, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user