From 4acde6d79cb61ab0415f0f75a55f7975953d6459 Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Mon, 4 Dec 2017 04:32:00 -0600 Subject: [PATCH] fix mixed up arguments, update settings footer --- plugin.go | 2 +- plugin.yaml | 4 ++-- plugin_test.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin.go b/plugin.go index d74234bf0..6ca66bd17 100644 --- a/plugin.go +++ b/plugin.go @@ -67,7 +67,7 @@ func (p *Plugin) ServeHTTP(w http.ResponseWriter, r *http.Request) { http.Error(w, err.Message, err.StatusCode) } else if team, err := p.api.GetTeamByName(r.URL.Query().Get("team")); err != nil { http.Error(w, err.Message, err.StatusCode) - } else if channel, err := p.api.GetChannelByName(team.Id, r.URL.Query().Get("channel")); err != nil { + } else if channel, err := p.api.GetChannelByName(r.URL.Query().Get("channel"), team.Id); err != nil { http.Error(w, err.Message, err.StatusCode) } else if _, err := p.api.CreatePost(&model.Post{ ChannelId: channel.Id, diff --git a/plugin.yaml b/plugin.yaml index 128ea7778..dfda001b4 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -3,7 +3,7 @@ backend: executable: plugin.exe name: JIRA description: Receives webhook events from JIRA and makes Mattermost posts for them. -version: '0.1' +version: '0.1.1' settings_schema: settings: - key: Enabled @@ -22,4 +22,4 @@ settings_schema: footer: | Use this webhook URL to set up the JIRA integration. See [documentation](https://about.mattermost.com/default-jira-plugin) to learn more. - `https://YOURSITE.COM/plugins/jira/webhook?secret=ABOVESECRET&team=TEAMURL&channel=CHANNELURL` + `https://SITEURL/plugins/jira/webhook?secret=WEBHOOKSECRET&team=TEAMURL&channel=CHANNELURL` diff --git a/plugin_test.go b/plugin_test.go index 06a4d0114..21eb4ce60 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -146,7 +146,7 @@ func TestPlugin(t *testing.T) { }, (*model.AppError)(nil)) api.On("GetTeamByName", "nottheteam").Return((*model.Team)(nil), model.NewAppError("foo", "bar", nil, "", http.StatusBadRequest)) - api.On("GetChannelByName", "theteamid", "thechannel").Run(func(args mock.Arguments) { + api.On("GetChannelByName", "thechannel", "theteamid").Run(func(args mock.Arguments) { api.On("CreatePost", mock.AnythingOfType("*model.Post")).Return(func(post *model.Post) (*model.Post, *model.AppError) { assert.Equal(t, post.ChannelId, "thechannelid") assert.Equal(t, post.Props["attachments"], []*model.SlackAttachment{expectedAttachment}) @@ -156,7 +156,7 @@ func TestPlugin(t *testing.T) { Id: "thechannelid", TeamId: "theteamid", }, (*model.AppError)(nil)) - api.On("GetChannelByName", "theteamid", "notthechannel").Return((*model.Channel)(nil), model.NewAppError("foo", "bar", nil, "", http.StatusBadRequest)) + api.On("GetChannelByName", "notthechannel", "theteamid").Return((*model.Channel)(nil), model.NewAppError("foo", "bar", nil, "", http.StatusBadRequest)) p := Plugin{} p.OnActivate(api)