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
Этот коммит содержится в:
Joram Wilander
2018-04-20 08:44:18 -04:00
коммит произвёл GitHub
родитель 7987c95fcd
Коммит 283f34b9c6
9 изменённых файлов: 197 добавлений и 5 удалений

Просмотреть файл

@@ -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)