Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

8272 added the username and icon url in the add and edit pages of outgoing webhook. #1470

Merged
merged 1 commit into from
Aug 15, 2018

Conversation

pradeepmurugesan
Copy link
Contributor

Summary

Adds the username and profile picture url options in the outgoing webhook.

Has some test's snapshots updated

screen shot 2018-07-22 at 21 56 50

Ticket Link

mattermost/mattermost#8272

Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]

  • Ran make check-style to check for style errors (required for all pull requests)
  • Ran make test to ensure unit and component tests passed
  • Added or updated unit tests (required for all new features)
  • Has server changes (please link)
  • Has redux changes (please link)
  • Has UI changes
  • Includes text changes and localization file (.../i18n/en.json) updates
  • Touches critical sections of the codebase (auth, posting, etc.)

@pradeepmurugesan pradeepmurugesan changed the title [WIP] 8272 added the username and icon url in the add and edit pages of outgoing webhook. 8272 added the username and icon url in the add and edit pages of outgoing webhook. Jul 23, 2018
@jasonblais jasonblais added 1: PM Review Requires review by a product manager Do Not Merge/Awaiting PR Awaiting another pull request before merging (e.g. server changes) labels Jul 23, 2018
@jasonblais jasonblais added Setup Old Test Server Triggers the creation of a test server and removed Do Not Merge/Awaiting PR Awaiting another pull request before merging (e.g. server changes) labels Jul 30, 2018
@mattermod
Copy link
Contributor

Setup Test Server label detected. Spinmint test server created if build succeeds (checks pass and no conflicts with base branch).

@mattermod
Copy link
Contributor

Spinmint test server created at: http:https://i-0e566c7fd2bac4e6b.test.spinmint.com

Test Admin Account: Username: sysadmin | Password: sysadmin

Test User Account: Username: user-1 | Password: user-1

Instance ID: i-0e566c7fd2bac4e6b

@wiersgallak
Copy link
Contributor

Thanks for your work on this @pradeepmurugesan! The UI looks great - Working on getting our test environment set up so I can verify it works as expected.

Copy link
Member

@lieut-data lieut-data left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a quick look at the code as well -- also looks good! Just a note to revert unexpected package-lock.json changes.

"lodash": "^4.2.0",
"source-map": "^0.5.0",
"trim-right": "^1.0.1"
"jsesc": "2.5.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file appears to have changes unrelated to this PR -- we usually coordinate our dependency upgrades once per release. Can you revert?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the package-lock.json from the commit

Copy link
Member

@lieut-data lieut-data left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@saturninoabril
Copy link
Member

@pradeepmurugesan I tried to setup an outgoing webhook from the test server above (http:https://i-0e566c7fd2bac4e6b.test.spinmint.com). Setting up is all good. However, after inspecting the payload being received by the external server, I'm not getting the overridden username and icon_url. The username I'm getting is the user_name who initiated the post (with trigger). No icon_url in the payload.
Could you please try the test server and see if it works for you? Thanks!

@lieut-data
Copy link
Member

@saturninoabril, unless I'm misunderstanding the feature request here, the settings @pradeepmurugesan have configured are the defaults for when the outgoing webhook server responds back to Mattermost. The resulting post could always specify an overriding username and icon_url, but this allows there to be a default if the payload /returned/ from the outgoing webhook server doesn't specify one explicitly.

@pradeepmurugesan
Copy link
Contributor Author

@saturninoabril the response sent by the external server is not overridden. If that payload doesn't contain username or icon_url , then we will override it when creating the post*.

*If you have configured the the username and icon_url while setting up and enabled the override option in system console.

@saturninoabril
Copy link
Member

Thanks @lieut-data.
I thought both the outgoing webhook and its response are overriden (as the title implied by the server PR mattermost/mattermost#9141).

@lieut-data
Copy link
Member

Ah, yes, that title was a bit misleading. I suspect there's not a lot of use sending the default icon/username to the outgoing webhook as such -- and I don't think slash commands work that way -- so I suspect the ticket was just a bit ambiguous. @wiersgallak, can you confirm the intent?

@saturninoabril
Copy link
Member

saturninoabril commented Aug 2, 2018

@pradeepmurugesan I'm a bit confused with the server code:

if a.Config().ServiceSettings.EnablePostUsernameOverride && hook.Username != "" && webhookResp.Username == "" {
    webhookResp.Username = hook.Username
}

I guess even if EnablePostUsernameOverride is true and hook.Username is set, we'll only override the username if the response from external server don't have the username set. Which makes me think that we cannot totally override the username even if we set it up in our Mattermost server.
I may be totally wrong. Could you please clarify if that's correct?

@wiersgallak
Copy link
Contributor

From review of the Jira ticket:
When set, this integration should use the given username and icon for posting, unless:

  1. The config settings "EnablePostUsernameOverride" and "EnablePostIconOverride" are changed to false
  2. The webhook payload specifies a different username or icon

@esethna esethna added this to the v5.3.0 milestone Aug 2, 2018
@saturninoabril
Copy link
Member

Cool, looks good to me.

@wiersgallak I tested this out using my simple server setup, and it works as expected.

@saturninoabril
Copy link
Member

This is awesome, thanks @pradeepmurugesan!

@wiersgallak
Copy link
Contributor

Great! As long as it works as expected it is good from my side as well. Thanks @pradeepmurugesan and team for reviewing!

@wiersgallak wiersgallak added 2: Dev Review Requires review by a core commiter and removed 1: PM Review Requires review by a product manager Setup Old Test Server Triggers the creation of a test server labels Aug 2, 2018
@mattermod
Copy link
Contributor

Spinmint test server destroyed

@lieut-data lieut-data added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core commiter labels Aug 2, 2018
@saturninoabril
Copy link
Member

Oh sorry for not merging this as soon as possible.

@saturninoabril saturninoabril merged commit f74e490 into mattermost:master Aug 15, 2018
@amyblais amyblais added Changelog/Done Required changelog entry has been written Docs/Not Needed Does not require documentation labels Aug 24, 2018
@lindalumitchell lindalumitchell added the Tests/Done Release tests have been written label Sep 4, 2018
fincha pushed a commit to fincha/mattermost-webapp that referenced this pull request Oct 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4: Reviews Complete All reviewers have approved the pull request Changelog/Done Required changelog entry has been written Docs/Not Needed Does not require documentation Tests/Done Release tests have been written
Projects
None yet
9 participants