diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index 6eb6963811b1..75d68a1ac63a 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -1162,6 +1162,7 @@ "Message_AllowDeleting": "Allow Message Deleting", "Message_AllowDeleting_BlockDeleteInMinutes": "Block Message Deleting After (n) Minutes", "Message_AllowDeleting_BlockDeleteInMinutes_Description": "Enter 0 to disable blocking.", + "Message_AllowDirectMessagesToYourself": "Allow user direct messages to yourself", "Message_AllowEditing": "Allow Message Editing", "Message_AllowEditing_BlockEditInMinutes": "Block Message Editing After (n) Minutes", "Message_AllowEditing_BlockEditInMinutesDescription": "Enter 0 to disable blocking.", diff --git a/packages/rocketchat-i18n/i18n/es.i18n.json b/packages/rocketchat-i18n/i18n/es.i18n.json index 1cd533f1ff2a..39227238a832 100644 --- a/packages/rocketchat-i18n/i18n/es.i18n.json +++ b/packages/rocketchat-i18n/i18n/es.i18n.json @@ -762,6 +762,7 @@ "Message_AllowDeleting": "Permitir la eliminación de mensajes", "Message_AllowDeleting_BlockDeleteInMinutes": "Bloquear la Eliminación de Mensajes Despues de (n) Minutos", "Message_AllowDeleting_BlockDeleteInMinutes_Description": "Introduzca 0 para desactivar el bloqueo.", + "Message_AllowDirectMessagesToYourself": "Permita mensajes directos del usuario a usted mismo", "Message_AllowEditing": "Permitir la edición de mensajes", "Message_AllowEditing_BlockEditInMinutes": "Bloquear la Edicion de Mensajes Despues de (n) Minutos", "Message_AllowEditing_BlockEditInMinutesDescription": "Ingrese 0 para deshabilitar el bloqueo.", diff --git a/packages/rocketchat-i18n/i18n/pt-BR.i18n.json b/packages/rocketchat-i18n/i18n/pt-BR.i18n.json index f87e98ddbf85..f172d3b5fc82 100644 --- a/packages/rocketchat-i18n/i18n/pt-BR.i18n.json +++ b/packages/rocketchat-i18n/i18n/pt-BR.i18n.json @@ -712,6 +712,7 @@ "Message_AllowDeleting": "Permitir Exclusão de Mensagem", "Message_AllowDeleting_BlockDeleteInMinutes": "Bloquear exclusão de mensagens após (n) minutos", "Message_AllowDeleting_BlockDeleteInMinutes_Description": "Digite 0 para desativar o bloqueio.", + "Message_AllowDirectMessagesToYourself": "Permitir mensagens diretas do usuário para si mesmo", "Message_AllowEditing": "Permitir Edição de Mensagem", "Message_AllowEditing_BlockEditInMinutes": "Bloquear edição de mensagens após (em minutos - 0 para desabilitar)", "Message_AllowEditing_BlockEditInMinutesDescription": "Insira 0 para desabilitar o bloqueio.", diff --git a/packages/rocketchat-i18n/i18n/pt.i18n.json b/packages/rocketchat-i18n/i18n/pt.i18n.json index d0d507ee96c3..ba9ac6820683 100644 --- a/packages/rocketchat-i18n/i18n/pt.i18n.json +++ b/packages/rocketchat-i18n/i18n/pt.i18n.json @@ -751,6 +751,7 @@ "Message_AllowDeleting": "Permitir Exclusão de Mensagem", "Message_AllowDeleting_BlockDeleteInMinutes": "Bloquear exclusão de mensagens após (n) minutos", "Message_AllowDeleting_BlockDeleteInMinutes_Description": "Digite 0 para desativar o bloqueio.", + "Message_AllowDirectMessagesToYourself": "Permitir mensagens diretas do usuário para si mesmo", "Message_AllowEditing": "Permitir Edição de Mensagem", "Message_AllowEditing_BlockEditInMinutes": "Bloquear edição de mensagens após (em minutos - 0 para desabilitar)", "Message_AllowEditing_BlockEditInMinutesDescription": "Insira 0 para desabilitar o bloqueio.", diff --git a/packages/rocketchat-lib/server/startup/settings.js b/packages/rocketchat-lib/server/startup/settings.js index a363e2e0d44a..f8ee1fe5466c 100644 --- a/packages/rocketchat-lib/server/startup/settings.js +++ b/packages/rocketchat-lib/server/startup/settings.js @@ -1002,6 +1002,10 @@ RocketChat.settings.addGroup('Message', function() { type: 'boolean', 'public': true }); + this.add('Message_AllowDirectMessagesToYourself', true, { + type: 'boolean', + 'public': true + }); this.add('Message_AlwaysSearchRegExp', false, { type: 'boolean' }); diff --git a/server/methods/createDirectMessage.js b/server/methods/createDirectMessage.js index e49c9ad17738..1dd43f293b02 100644 --- a/server/methods/createDirectMessage.js +++ b/server/methods/createDirectMessage.js @@ -16,7 +16,7 @@ Meteor.methods({ }); } - if (me.username === username) { + if (RocketChat.settings.get('Message_AllowDirectMessagesToYourself') === false && me.username === username) { throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'createDirectMessage' });