From 6772472a97d3d82eab06d40d0c85e574145a051d Mon Sep 17 00:00:00 2001 From: Gabriel Delavald Date: Mon, 12 Jun 2017 17:54:17 -0300 Subject: [PATCH] New error message when opening a direct chat with yourself --- packages/rocketchat-i18n/i18n/en.i18n.json | 1 + packages/rocketchat-ui/client/views/404/roomNotFound.html | 6 +++++- packages/rocketchat-ui/client/views/404/roomNotFound.js | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index 1b2888536b9a..62b4df3ac84b 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -279,6 +279,7 @@ "Cancel": "Cancel", "Cancel_message_input": "Cancel", "Cannot_invite_users_to_direct_rooms": "Cannot invite users to direct rooms", + "Cannot_open_conversation_with_yourself": "Cannot open a conversation with yourself", "CAS_autoclose": "Autoclose login popup", "CAS_base_url": "SSO Base URL", "CAS_base_url_Description": "The base URL of your external SSO service e.g: https://sso.example.undef/sso/", diff --git a/packages/rocketchat-ui/client/views/404/roomNotFound.html b/packages/rocketchat-ui/client/views/404/roomNotFound.html index 9d653a0cce26..0fc3a73c8494 100644 --- a/packages/rocketchat-ui/client/views/404/roomNotFound.html +++ b/packages/rocketchat-ui/client/views/404/roomNotFound.html @@ -17,7 +17,11 @@

{{{_ 'No_group_with_name_%s_was_found' name}}} {{/if}} {{#if $eq type 'd'}} - {{{_ 'No_user_with_username_%s_was_found' name}}} + {{#if sameUser }} + {{{_ 'Cannot_open_conversation_with_yourself' }}} + {{else}} + {{{_ 'No_user_with_username_%s_was_found' name}}} + {{/if}} {{/if}} {{/with}} diff --git a/packages/rocketchat-ui/client/views/404/roomNotFound.js b/packages/rocketchat-ui/client/views/404/roomNotFound.js index c09dc1f0190b..251389df7272 100644 --- a/packages/rocketchat-ui/client/views/404/roomNotFound.js +++ b/packages/rocketchat-ui/client/views/404/roomNotFound.js @@ -4,5 +4,9 @@ Template.roomNotFound.helpers({ }, name() { return Blaze._escape(this.name); + }, + sameUser() { + const user = Meteor.user(); + return user && user.username === this.name; } });