summaryrefslogtreecommitdiffstats
path: root/store/sql_webhook_store.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-01-11 10:04:01 -0600
committer=Corey Hulen <corey@hulen.com>2016-01-11 10:04:01 -0600
commit2fd597043b45a75495164915ba6c41d5ab18c5ae (patch)
tree41df6781fa1a42777f6cea867b95dc30f08aa5d0 /store/sql_webhook_store.go
parent2bf43e79582c2e8ca50caa29d7457716112b4796 (diff)
downloadchat-2fd597043b45a75495164915ba6c41d5ab18c5ae.tar.gz
chat-2fd597043b45a75495164915ba6c41d5ab18c5ae.tar.bz2
chat-2fd597043b45a75495164915ba6c41d5ab18c5ae.zip
Chaning webhooks to be team wide
Diffstat (limited to 'store/sql_webhook_store.go')
-rw-r--r--store/sql_webhook_store.go27
1 files changed, 3 insertions, 24 deletions
diff --git a/store/sql_webhook_store.go b/store/sql_webhook_store.go
index b7bf0615f..c65384ec1 100644
--- a/store/sql_webhook_store.go
+++ b/store/sql_webhook_store.go
@@ -134,7 +134,7 @@ func (s SqlWebhookStore) PermanentDeleteIncomingByUser(userId string) StoreChann
return storeChannel
}
-func (s SqlWebhookStore) GetIncomingByUser(userId string) StoreChannel {
+func (s SqlWebhookStore) GetIncomingByTeam(teamId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -142,8 +142,8 @@ func (s SqlWebhookStore) GetIncomingByUser(userId string) StoreChannel {
var webhooks []*model.IncomingWebhook
- if _, err := s.GetReplica().Select(&webhooks, "SELECT * FROM IncomingWebhooks WHERE UserId = :UserId AND DeleteAt = 0", map[string]interface{}{"UserId": userId}); err != nil {
- result.Err = model.NewAppError("SqlWebhookStore.GetIncomingByUser", "We couldn't get the webhook", "userId="+userId+", err="+err.Error())
+ if _, err := s.GetReplica().Select(&webhooks, "SELECT * FROM IncomingWebhooks WHERE TeamId = :TeamId AND DeleteAt = 0", map[string]interface{}{"TeamId": teamId}); err != nil {
+ result.Err = model.NewAppError("SqlWebhookStore.GetIncomingByUser", "We couldn't get the webhook", "teamId="+teamId+", err="+err.Error())
}
result.Data = webhooks
@@ -231,27 +231,6 @@ func (s SqlWebhookStore) GetOutgoing(id string) StoreChannel {
return storeChannel
}
-func (s SqlWebhookStore) GetOutgoingByCreator(userId string) StoreChannel {
- storeChannel := make(StoreChannel)
-
- go func() {
- result := StoreResult{}
-
- var webhooks []*model.OutgoingWebhook
-
- if _, err := s.GetReplica().Select(&webhooks, "SELECT * FROM OutgoingWebhooks WHERE CreatorId = :UserId AND DeleteAt = 0", map[string]interface{}{"UserId": userId}); err != nil {
- result.Err = model.NewAppError("SqlWebhookStore.GetOutgoingByCreator", "We couldn't get the webhooks", "userId="+userId+", err="+err.Error())
- }
-
- result.Data = webhooks
-
- storeChannel <- result
- close(storeChannel)
- }()
-
- return storeChannel
-}
-
func (s SqlWebhookStore) GetOutgoingByChannel(channelId string) StoreChannel {
storeChannel := make(StoreChannel)