diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index 1b4ee2753961..dff853cce2ed 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -65,6 +65,7 @@ "Add_Members" : "Add Members", "Add_users" : "Add users", "Administration" : "Administration", + "Alias" : "Alias", "All_channels" : "All channels", "Allow_Invalid_SelfSigned_Certs" : "Allow Invalid Self-Signed Certs", "Allow_Invalid_SelfSigned_Certs_Description" : "Allow invalid and self-signed SSL certificate's for link validation and previews.", @@ -79,6 +80,7 @@ "Are_you_sure" : "Are you sure?", "Auto_Load_Images" : "Auto Load Images", "Avatar_changed_successfully" : "Avatar changed successfully", + "Avatar_URL" : "Avatar URL", "Avatar_url_invalid_or_error" : "The url provided is invalid or not accessible. Please try again, but with a different url.", "away" : "away", "Away" : "Away", @@ -102,6 +104,7 @@ "Channels" : "Channels", "Channels_list" : "List of public channels", "Chat_Rooms" : "Chat Rooms", + "Choose_the_alias_that_will_appear_before_the_username_in_messages" : "Choose the alias that will appear before the username in messages.", "Choose_the_username_that_this_integration_will_post_as" : "Choose the username that this integration will post as.", "Clear_all_unreads_question" : "Clear all unreads?", "close" : "close", @@ -118,6 +121,7 @@ "Create_new_private_group" : "Create a new private group", "Create_new_public_channel" : "Create a new public channel", "Created_at" : "Created at", + "Created_at_s_by_s" : "Created at %s by %s", "Custom_oauth_helper" : "When setting up your OAuth Provider, you'll have to inform a Callback URL. Use
%s
.", "Custom_oauth_unique_name" : "Custom oauth unique name", "days" : "days", @@ -153,8 +157,8 @@ "FileUpload" : "File Upload", "FileUpload_Enabled" : "File Uploads Enabled", "FileUpload_MaxFileSize" : "Maximum File Upload Size (in bytes)", - "FileUpload_MediaTypeWhiteList" : "Accepted Media Types", "FileUpload_MediaType_NotAccepted" : "Media Types Not Accepted", + "FileUpload_MediaTypeWhiteList" : "Accepted Media Types", "FileUpload_MediaTypeWhiteListDescription" : "Comma-separated list of media types", "Follow_social_profiles" : "Follow our social profiles, fork us on github and share your thoughts about the rocket.chat app on our trello board.", "Forgot_password" : "Forgot your password", @@ -285,6 +289,7 @@ "Name" : "Name", "Name_cant_be_empty" : "Name can't be empty", "Name_optional" : "Name (optional)", + "New_integration" : "New integration", "New_messages" : "New messages", "New_password" : "New password", "No_channel_with_name_%s_was_found" : "No channel with name \"%s\" was found!", @@ -320,10 +325,8 @@ "Please_wait_activation" : "Please wait, this can take some time.", "Please_wait_statistics" : "Please wait, statistics are being generated.", "Post_as" : "Post as", - "New_integration" : "New integration", - "Post_to_s_as_s" : "Post to %s as %s", - "Created_at_s_by_s" : "Created at %s by %s", "Post_to_Channel" : "Post to Channel", + "Post_to_s_as_s" : "Post to %s as %s", "Powered_by" : "Powered by", "Preferences" : "Preferences", "Preferences_saved" : "Preferences saved", @@ -402,6 +405,7 @@ "Send_your_JSON_payloads_to_this_URL" : "Send your JSON payloads to this URL.", "Settings" : "Settings", "Settings_updated" : "Settings updated", + "Should_be_a_URL_of_an_image" : "Should be a URL of an image.", "Should_exists_a_user_with_this_username" : "Should exists a user with this username.", "Showing_online_users" : "Showing __total_online__ of __total__ users", "Showing_results" : "

Showing %s results

", @@ -481,6 +485,7 @@ "User_left_male" : "Has left the channel.", "User_logged_out" : "User is logged out", "User_not_found_or_incorrect_password" : "User not found or incorrect password", + "User_or_channel_name" : "User or channel name", "User_removed_by" : "User __user_removed__ removed by __user_by__.", "User_Settings" : "User Settings", "User_updated_successfully" : "User updated successfully", @@ -505,6 +510,7 @@ "Yes_clear_all" : "Yes, clear all!", "Yes_delete_it" : "Yes, delete it!", "you_are_in_preview_mode_of" : "You are in preview mode of channel #__room_name__", + "You_can_change_a_different_avatar_too" : "You can change a different avatar too", "You_need_confirm_email" : "You need to confirm your email to login!", "You_should_name_it_to_easily_manage_your_integrations" : "You should name it to easily manage your integrations.", "You_will_not_be_able_to_recover" : "You will not be able to recover this message!", diff --git a/packages/rocketchat-integrations/client/stylesheets/integrations.less b/packages/rocketchat-integrations/client/stylesheets/integrations.less index 129cf9e9e31f..04e51fba4147 100644 --- a/packages/rocketchat-integrations/client/stylesheets/integrations.less +++ b/packages/rocketchat-integrations/client/stylesheets/integrations.less @@ -40,3 +40,9 @@ border-bottom: none; } } + +.message-example { + li { + list-style: none; + } +} diff --git a/packages/rocketchat-integrations/client/views/integrationsIncoming.coffee b/packages/rocketchat-integrations/client/views/integrationsIncoming.coffee index 715ffb0ffbbc..28f19b530c6f 100644 --- a/packages/rocketchat-integrations/client/views/integrationsIncoming.coffee +++ b/packages/rocketchat-integrations/client/views/integrationsIncoming.coffee @@ -1,3 +1,8 @@ +Template.integrationsIncoming.onCreated -> + @record = new ReactiveVar + username: 'rocket.cat' + + Template.integrationsIncoming.helpers hasPermission: -> @@ -10,12 +15,42 @@ Template.integrationsIncoming.helpers data = ChatIntegrations.findOne({_id: params.id}) if data? data.url = Meteor.absoluteUrl("hooks/#{encodeURIComponent(data._id)}/#{encodeURIComponent(data.userId)}/#{encodeURIComponent(data.token)}") + Template.instance().record.set data return data - return {} + return Template.instance().record.curValue + + example: -> + record = Template.instance().record.get() + return {} = + _id: Random.id() + alias: record.alias + avatar: record.avatar + msg: 'Example message' + bot: + i: Random.id() + attachments: [{ + title: "Rocket.Chat" + title_link: "https://rocket.chat" + text: "Rocket.Chat, the best open source chat" + image_url: "https://rocket.chat/images/mockup.png" + color: "#764FA5" + }] + ts: new Date + u: + _id: Random.id() + username: record.username Template.integrationsIncoming.events + "blur input": (e, t) -> + t.record.set + name: $('[name=name]').val().trim() + alias: $('[name=alias]').val().trim() + avatar: $('[name=avatar]').val().trim() + channel: $('[name=channel]').val().trim() + username: $('[name=username]').val().trim() + "click .submit > .delete": -> params = Template.instance().data.params() @@ -42,6 +77,8 @@ Template.integrationsIncoming.events "click .submit > .save": -> name = $('[name=name]').val().trim() + alias = $('[name=alias]').val().trim() + avatar = $('[name=avatar]').val().trim() channel = $('[name=channel]').val().trim() username = $('[name=username]').val().trim() @@ -53,6 +90,8 @@ Template.integrationsIncoming.events integration = channel: channel + alias: alias if alias isnt '' + avatar: avatar if avatar isnt '' name: name if name isnt '' params = Template.instance().data.params?() diff --git a/packages/rocketchat-integrations/client/views/integrationsIncoming.html b/packages/rocketchat-integrations/client/views/integrationsIncoming.html index 976ad0c97e09..d17db30e5c59 100644 --- a/packages/rocketchat-integrations/client/views/integrationsIncoming.html +++ b/packages/rocketchat-integrations/client/views/integrationsIncoming.html @@ -23,7 +23,7 @@
- {{#if data.username}} + {{#if data.token}} {{else}} @@ -32,6 +32,21 @@
{{_ "Should_exists_a_user_with_this_username"}}
+
+ +
+ +
{{_ "Choose_the_alias_that_will_appear_before_the_username_in_messages"}}
+
+
+
+ +
+ +
{{_ "You_can_change_a_different_avatar_too"}}
+
{{_ "Should_be_a_URL_of_an_image"}}
+
+
{{#if data.token}}
@@ -42,6 +57,9 @@
{{/if}} +
+ {{#nrr nrrargs 'message' example}}{{/nrr}} +
diff --git a/packages/rocketchat-integrations/server/api/api.coffee b/packages/rocketchat-integrations/server/api/api.coffee index e9aed7143932..4001e3c09a79 100644 --- a/packages/rocketchat-integrations/server/api/api.coffee +++ b/packages/rocketchat-integrations/server/api/api.coffee @@ -71,6 +71,8 @@ Api.addRoute ':integrationId/:userId/:token', authRequired: true, error: 'invalid-channel-type' message = + avatar: integration.avatar + alias: integration.alias msg: @bodyParams.text or '' attachments: @bodyParams.attachments parseUrls: false diff --git a/packages/rocketchat-integrations/server/methods/updateIntegration.coffee b/packages/rocketchat-integrations/server/methods/updateIntegration.coffee index 272348dcbe06..d41d0e3d145a 100644 --- a/packages/rocketchat-integrations/server/methods/updateIntegration.coffee +++ b/packages/rocketchat-integrations/server/methods/updateIntegration.coffee @@ -39,6 +39,8 @@ Meteor.methods RocketChat.models.Integrations.update integrationId, $set: name: integration.name + avatar: integration.avatar + alias: integration.alias channel: integration.channel _updatedAt: new Date _updatedBy: RocketChat.models.Users.findOne @userId, {fields: {username: 1}} diff --git a/packages/rocketchat-theme/assets/stylesheets/base.less b/packages/rocketchat-theme/assets/stylesheets/base.less index 2208b33a840d..2ba3fe0465b4 100644 --- a/packages/rocketchat-theme/assets/stylesheets/base.less +++ b/packages/rocketchat-theme/assets/stylesheets/base.less @@ -427,6 +427,7 @@ select, input[type='text'], input[type='number'], input[type='email'], +input[type='url'], input[type='password'] { -webkit-appearance: none; height: 35px; @@ -466,6 +467,7 @@ form.inline { input[type='text'], input[type='number'], input[type='email'], + input[type='url'], input[type='password'] { width: auto; } @@ -2700,6 +2702,11 @@ a.github-fork { &.temp .body { opacity: .5; } + .message-alias { + color: #aaa; + font-weight: 400; + padding-left: 2px; + } } .compact { diff --git a/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less b/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less index e0cb54f452a4..7bdb7b45f75c 100644 --- a/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less +++ b/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less @@ -136,6 +136,7 @@ select, input[type='text'], input[type='number'], input[type='email'], +input[type='url'], input[type='password'] { border-color: #E7E7E7; background-color: #fff; diff --git a/packages/rocketchat-ui-message/message/message.html b/packages/rocketchat-ui-message/message/message.html index 5a3ced89fa26..0ae084bfc99c 100644 --- a/packages/rocketchat-ui-message/message/message.html +++ b/packages/rocketchat-ui-message/message/message.html @@ -1,7 +1,19 @@