diff options
author | Joram Wilander <jwawilander@gmail.com> | 2018-04-20 08:44:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-20 08:44:18 -0400 |
commit | 283f34b9c6d207f0a103e7b4c7f6da2c7481c3ef (patch) | |
tree | 9a9d0dfb9f536d37e9817e3407c32e7ec0c11cdf /model/utils.go | |
parent | 7987c95fcd7f7a9e6d4d174be403bf170f7b9115 (diff) | |
download | chat-283f34b9c6d207f0a103e7b4c7f6da2c7481c3ef.tar.gz chat-283f34b9c6d207f0a103e7b4c7f6da2c7481c3ef.tar.bz2 chat-283f34b9c6d207f0a103e7b4c7f6da2c7481c3ef.zip |
MM-10007 Send an admin and regular WS events when a user is updated (#8588)
* Add user.DeepCopy() function
* Add omit admins/non-admins to WS broadcast and use for updating users
* Updates per feedback and adding unit test for ShouldSendEvent
Diffstat (limited to 'model/utils.go')
-rw-r--r-- | model/utils.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/model/utils.go b/model/utils.go index 2d61b49f6..9f8ef90e1 100644 --- a/model/utils.go +++ b/model/utils.go @@ -148,6 +148,14 @@ func GetMillis() int64 { return time.Now().UnixNano() / int64(time.Millisecond) } +func CopyStringMap(originalMap map[string]string) map[string]string { + copyMap := make(map[string]string) + for k, v := range originalMap { + copyMap[k] = v + } + return copyMap +} + // MapToJson converts a map to a json string func MapToJson(objmap map[string]string) string { b, _ := json.Marshal(objmap) |