diff --git a/services/socketwrap/clientManager.go b/services/socketwrap/clientManager.go index 0b5930549..d6d36796e 100644 --- a/services/socketwrap/clientManager.go +++ b/services/socketwrap/clientManager.go @@ -50,13 +50,7 @@ func (h *ClientsManager) Run() { } case message := <-models.ActionChan: if isInOpTypes(opTypes, message.OpType) { - message.Comment = nil - message.ActUser.Email = "" - message.ActUser.Passwd = "" - message.ActUser.PasswdHashAlgo = "" - message.ActUser.PrivateKey = "" - message.ActUser.PublicKey = "" - message.ActUser.Salt = "" + filterUserPrivateInfo(message) LastActionsQueue.Push(message) for _, client := range h.Clients.Keys() { select { @@ -101,12 +95,7 @@ func initActionQueue() { user, err := models.GetUserByID(actions[i].UserID) if err == nil { if !user.IsOrganization() { - actions[i].ActUser.Email = "" - actions[i].ActUser.Passwd = "" - actions[i].ActUser.PasswdHashAlgo = "" - actions[i].ActUser.PrivateKey = "" - actions[i].ActUser.PublicKey = "" - actions[i].ActUser.Salt = "" + filterUserPrivateInfo(actions[i]) LastActionsQueue.Push(actions[i]) } @@ -115,3 +104,14 @@ func initActionQueue() { } } } + +func filterUserPrivateInfo(action *models.Action) { + action.Comment = nil + action.ActUser.Email = "" + action.ActUser.Passwd = "" + action.ActUser.PasswdHashAlgo = "" + action.ActUser.PrivateKey = "" + action.ActUser.PublicKey = "" + action.ActUser.Salt = "" + action.ActUser.FullName = "" +}