From b5007602ecedd54c69d848d451d33809d3d20673 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Wed, 26 Jan 2022 14:39:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E5=8A=A8=E6=80=81=E4=B8=AD?= =?UTF-8?q?=E7=9A=84fullname=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/socketwrap/clientManager.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) 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 = "" +}