From f93ba3cd23adb55d068f37ea83a1cdf0f7a1b98c Mon Sep 17 00:00:00 2001 From: Lev <1187448+levb@users.noreply.github.com> Date: Thu, 11 Apr 2019 16:35:29 -0700 Subject: [PATCH] MM-14795 Added "from_webhook" to protected props in DoPostAction (#10593) Per @hanzei's request https://github.com/mattermost/mattermost-server/pull/10546#issuecomment-481997493 https://mattermost.atlassian.net/browse/MM-14795 --- app/integration_action_test.go | 3 +++ model/integration_action.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/integration_action_test.go b/app/integration_action_test.go index edf95eed93..6ace637204 100644 --- a/app/integration_action_test.go +++ b/app/integration_action_test.go @@ -328,6 +328,7 @@ func TestPostActionProps(t *testing.T) { "has_reactions": true, "is_pinned": false, "props": { + "from_webhook":true, "override_username":"new_override_user", "override_icon_url":"new_override_icon", "A":"AA" @@ -366,6 +367,7 @@ func TestPostActionProps(t *testing.T) { }, }, "override_icon_url": "old_override_icon", + "from_webhook": false, "B": "BB", }, } @@ -390,6 +392,7 @@ func TestPostActionProps(t *testing.T) { assert.Nil(t, newPost.Props["override_username"]) assert.Equal(t, "AA", newPost.Props["A"]) assert.Equal(t, "old_override_icon", newPost.Props["override_icon_url"]) + assert.Equal(t, false, newPost.Props["from_webhook"]) } func TestSubmitInteractiveDialog(t *testing.T) { diff --git a/model/integration_action.go b/model/integration_action.go index b7762333fb..58741788a8 100644 --- a/model/integration_action.go +++ b/model/integration_action.go @@ -26,7 +26,7 @@ const ( INTERACTIVE_DIALOG_TRIGGER_TIMEOUT_MILLISECONDS = 3000 ) -var PostActionRetainPropKeys = []string{"override_username", "override_icon_url"} +var PostActionRetainPropKeys = []string{"from_webhook", "override_username", "override_icon_url"} type DoPostActionRequest struct { SelectedOption string `json:"selected_option,omitempty"`