Fixed error when adding incoming webhook to public channel not currently in (#3483)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
c0392a60c8
Коммит
f9e5a9029c
@@ -77,6 +77,7 @@ func createIncomingHook(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
c.LogAudit("fail - bad channel permissions")
|
c.LogAudit("fail - bad channel permissions")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
c.Err = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if result := <-Srv.Store.Webhook().SaveIncoming(hook); result.Err != nil {
|
if result := <-Srv.Store.Webhook().SaveIncoming(hook); result.Err != nil {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ func TestCreateIncomingHook(t *testing.T) {
|
|||||||
team := th.SystemAdminTeam
|
team := th.SystemAdminTeam
|
||||||
channel1 := th.CreateChannel(Client, team)
|
channel1 := th.CreateChannel(Client, team)
|
||||||
channel2 := th.CreatePrivateChannel(Client, team)
|
channel2 := th.CreatePrivateChannel(Client, team)
|
||||||
|
channel3 := th.CreateChannel(Client, team)
|
||||||
user2 := th.CreateUser(Client)
|
user2 := th.CreateUser(Client)
|
||||||
LinkUserToTeam(user2, team)
|
LinkUserToTeam(user2, team)
|
||||||
|
|
||||||
@@ -68,6 +69,13 @@ func TestCreateIncomingHook(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Client.Must(Client.LeaveChannel(channel3.Id))
|
||||||
|
|
||||||
|
hook = &model.IncomingWebhook{ChannelId: channel3.Id, UserId: user.Id, TeamId: team.Id}
|
||||||
|
if _, err := Client.CreateIncomingWebhook(hook); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
Client.Logout()
|
Client.Logout()
|
||||||
Client.Must(Client.LoginById(user2.Id, user2.Password))
|
Client.Must(Client.LoginById(user2.Id, user2.Password))
|
||||||
Client.SetTeamId(team.Id)
|
Client.SetTeamId(team.Id)
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user