Skip to content

Commit

Permalink
fix mixed up arguments, update settings footer
Browse files Browse the repository at this point in the history
  • Loading branch information
ccbrown committed Dec 4, 2017
1 parent e97529d commit 4acde6d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`
4 changes: 2 additions & 2 deletions plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand All @@ -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)
Expand Down

0 comments on commit 4acde6d

Please sign in to comment.