diff options
author | Christopher Speller <crspeller@gmail.com> | 2015-10-23 08:34:57 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2015-10-23 08:34:57 -0400 |
commit | c8edad29c1a1c86fe3ac20ab4da8cc99f038c2a6 (patch) | |
tree | 4ab3c63173c52f71a98925c478ca00be4df0225c /store/sql_webhook_store.go | |
parent | 8db383d2e33520fcf4318f27d905418abdbc28da (diff) | |
parent | a431ba2c22918412d90d00c37fb89f6841f47eb8 (diff) | |
download | chat-c8edad29c1a1c86fe3ac20ab4da8cc99f038c2a6.tar.gz chat-c8edad29c1a1c86fe3ac20ab4da8cc99f038c2a6.tar.bz2 chat-c8edad29c1a1c86fe3ac20ab4da8cc99f038c2a6.zip |
Merge pull request #1149 from mattermost/plt-808
PLT-808 Fix deleting channels breaking the webhook UI
Diffstat (limited to 'store/sql_webhook_store.go')
-rw-r--r-- | store/sql_webhook_store.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/store/sql_webhook_store.go b/store/sql_webhook_store.go index 1910984f0..c758e2339 100644 --- a/store/sql_webhook_store.go +++ b/store/sql_webhook_store.go @@ -137,6 +137,27 @@ func (s SqlWebhookStore) GetIncomingByUser(userId string) StoreChannel { return storeChannel } +func (s SqlWebhookStore) GetIncomingByChannel(channelId string) StoreChannel { + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + + var webhooks []*model.IncomingWebhook + + if _, err := s.GetReplica().Select(&webhooks, "SELECT * FROM IncomingWebhooks WHERE ChannelId = :ChannelId AND DeleteAt = 0", map[string]interface{}{"ChannelId": channelId}); err != nil { + result.Err = model.NewAppError("SqlWebhookStore.GetIncomingByChannel", "We couldn't get the webhooks", "channelId="+channelId+", err="+err.Error()) + } + + result.Data = webhooks + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} + func (s SqlWebhookStore) SaveOutgoing(webhook *model.OutgoingWebhook) StoreChannel { storeChannel := make(StoreChannel) |