From 283f34b9c6d207f0a103e7b4c7f6da2c7481c3ef Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 20 Apr 2018 08:44:18 -0400 Subject: 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 --- model/utils.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'model/utils.go') 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) -- cgit v1.2.3-1-g7c22