summaryrefslogtreecommitdiffstats
path: root/store/sqlstore/channel_store.go
diff options
context:
space:
mode:
authorMartin Kraft <martinkraft@gmail.com>2018-05-15 07:45:28 -0400
committerMartin Kraft <martinkraft@gmail.com>2018-05-15 07:45:28 -0400
commitf82cc7896dd57c4c96471bcbbd2b1a39f908e5e7 (patch)
treed3899b890408f6f16b2d5f543bf975475f1a5584 /store/sqlstore/channel_store.go
parent51bd710ecdca6628461c9fa2679737073e4d5059 (diff)
parenta1656dffa98fbc8865e476b214e4e0c562547d39 (diff)
downloadchat-f82cc7896dd57c4c96471bcbbd2b1a39f908e5e7.tar.gz
chat-f82cc7896dd57c4c96471bcbbd2b1a39f908e5e7.tar.bz2
chat-f82cc7896dd57c4c96471bcbbd2b1a39f908e5e7.zip
Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2
Diffstat (limited to 'store/sqlstore/channel_store.go')
-rw-r--r--store/sqlstore/channel_store.go37
1 files changed, 3 insertions, 34 deletions
diff --git a/store/sqlstore/channel_store.go b/store/sqlstore/channel_store.go
index dceebc92e..4baddddb2 100644
--- a/store/sqlstore/channel_store.go
+++ b/store/sqlstore/channel_store.go
@@ -466,25 +466,6 @@ func (s SqlChannelStore) Update(channel *model.Channel) store.StoreChannel {
})
}
-func (s SqlChannelStore) extraUpdated(channel *model.Channel) store.StoreChannel {
- return store.Do(func(result *store.StoreResult) {
- channel.ExtraUpdated()
-
- _, err := s.GetMaster().Exec(
- `UPDATE
- Channels
- SET
- ExtraUpdateAt = :Time
- WHERE
- Id = :Id`,
- map[string]interface{}{"Id": channel.Id, "Time": channel.ExtraUpdateAt})
-
- if err != nil {
- result.Err = model.NewAppError("SqlChannelStore.extraUpdated", "store.sql_channel.extra_updated.app_error", nil, "id="+channel.Id+", "+err.Error(), http.StatusInternalServerError)
- }
- })
-}
-
func (s SqlChannelStore) GetChannelUnread(channelId, userId string) store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
var unreadChannel model.ChannelUnread
@@ -1313,21 +1294,9 @@ func (s SqlChannelStore) GetMemberCount(channelId string, allowFromCache bool) s
func (s SqlChannelStore) RemoveMember(channelId string, userId string) store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
- // Grab the channel we are saving this member to
- if cr := <-s.Get(channelId, true); cr.Err != nil {
- result.Err = cr.Err
- } else {
- channel := cr.Data.(*model.Channel)
-
- _, err := s.GetMaster().Exec("DELETE FROM ChannelMembers WHERE ChannelId = :ChannelId AND UserId = :UserId", map[string]interface{}{"ChannelId": channelId, "UserId": userId})
- if err != nil {
- result.Err = model.NewAppError("SqlChannelStore.RemoveMember", "store.sql_channel.remove_member.app_error", nil, "channel_id="+channelId+", user_id="+userId+", "+err.Error(), http.StatusInternalServerError)
- } else {
- // If successfull record members have changed in channel
- if mu := <-s.extraUpdated(channel); mu.Err != nil {
- result.Err = mu.Err
- }
- }
+ _, err := s.GetMaster().Exec("DELETE FROM ChannelMembers WHERE ChannelId = :ChannelId AND UserId = :UserId", map[string]interface{}{"ChannelId": channelId, "UserId": userId})
+ if err != nil {
+ result.Err = model.NewAppError("SqlChannelStore.RemoveMember", "store.sql_channel.remove_member.app_error", nil, "channel_id="+channelId+", user_id="+userId+", "+err.Error(), http.StatusInternalServerError)
}
})
}