diff options
author | Jonathan <jonfritz@gmail.com> | 2018-03-07 10:54:51 -0500 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2018-03-07 15:54:51 +0000 |
commit | d448a6bef30339a63b7c118b8b2deb44cdb79d8e (patch) | |
tree | 4158c94595bf37e1e1aaf41b8441b73bd480b1c0 /app/channel.go | |
parent | 09713ff4eadd3d706df45cb69f096b66c5b283fd (diff) | |
download | chat-d448a6bef30339a63b7c118b8b2deb44cdb79d8e.tar.gz chat-d448a6bef30339a63b7c118b8b2deb44cdb79d8e.tar.bz2 chat-d448a6bef30339a63b7c118b8b2deb44cdb79d8e.zip |
XYZ-87: GlobalRelay DM Exports do not Include Channel Name (#8275)
* Adding ChannelMemberHistory table records when DM channels are created. This ensures that both participants in a DM are shown in compliance export, even if only one of them typed anything
* Direct/Group Message channels now get pretty display names for the purpose of compliance exports
* Fixed string formatting in t.Fatal calls
* Changed uses of ChannelMemberHistory over to ChannelMemberHistoryResult in tests. This should have been done as a part of the work in XYZ-110, but seems to have been missed in this branch for some reason
Diffstat (limited to 'app/channel.go')
-rw-r--r-- | app/channel.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/app/channel.go b/app/channel.go index edece8c98..76147a508 100644 --- a/app/channel.go +++ b/app/channel.go @@ -225,6 +225,14 @@ func (a *App) createDirectChannel(userId string, otherUserId string) (*model.Cha } } else { channel := result.Data.(*model.Channel) + + if result := <-a.Srv.Store.ChannelMemberHistory().LogJoinEvent(userId, channel.Id, model.GetMillis()); result.Err != nil { + l4g.Warn("Failed to update ChannelMemberHistory table %v", result.Err) + } + if result := <-a.Srv.Store.ChannelMemberHistory().LogJoinEvent(otherUserId, channel.Id, model.GetMillis()); result.Err != nil { + l4g.Warn("Failed to update ChannelMemberHistory table %v", result.Err) + } + return channel, nil } } @@ -1426,7 +1434,16 @@ func (a *App) GetDirectChannel(userId1, userId2 string) (*model.Channel, *model. } a.InvalidateCacheForUser(userId1) a.InvalidateCacheForUser(userId2) - return result.Data.(*model.Channel), nil + + channel := result.Data.(*model.Channel) + if result := <-a.Srv.Store.ChannelMemberHistory().LogJoinEvent(userId1, channel.Id, model.GetMillis()); result.Err != nil { + l4g.Warn("Failed to update ChannelMemberHistory table %v", result.Err) + } + if result := <-a.Srv.Store.ChannelMemberHistory().LogJoinEvent(userId2, channel.Id, model.GetMillis()); result.Err != nil { + l4g.Warn("Failed to update ChannelMemberHistory table %v", result.Err) + } + + return channel, nil } else if result.Err != nil { return nil, model.NewAppError("GetOrCreateDMChannel", "web.incoming_webhook.channel.app_error", nil, "err="+result.Err.Message, result.Err.StatusCode) } |