From 6b23795ff3a5baddbfd1a59ab6792fc2374610fe Mon Sep 17 00:00:00 2001 From: Harshil Sharma Date: Thu, 9 Dec 2021 01:17:47 +0530 Subject: [PATCH] Removed unused fields (#1944) * removed unused fields * lint fix Co-authored-by: Scott Bishel --- server/integrationtests/user_test.go | 2 +- server/model/user.go | 2 +- .../store/mattermostauthlayer/mattermostauthlayer.go | 9 ++------- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/server/integrationtests/user_test.go b/server/integrationtests/user_test.go index b73f5a162..db81ff2da 100644 --- a/server/integrationtests/user_test.go +++ b/server/integrationtests/user_test.go @@ -114,7 +114,7 @@ func TestGetMe(t *testing.T) { me, resp := th.Client.GetMe() require.NoError(t, resp.Error) require.NotNil(t, me) - require.Equal(t, registerRequest.Email, me.Email) + require.Equal(t, "", me.Email) require.Equal(t, registerRequest.Username, me.Username) }) } diff --git a/server/model/user.go b/server/model/user.go index 2db42b200..781f7a80b 100644 --- a/server/model/user.go +++ b/server/model/user.go @@ -18,7 +18,7 @@ type User struct { // The user's email // required: true - Email string `json:"email"` + Email string `json:"-"` // swagger:ignore Password string `json:"-"` diff --git a/server/services/store/mattermostauthlayer/mattermostauthlayer.go b/server/services/store/mattermostauthlayer/mattermostauthlayer.go index 40b276ad3..e1d827006 100644 --- a/server/services/store/mattermostauthlayer/mattermostauthlayer.go +++ b/server/services/store/mattermostauthlayer/mattermostauthlayer.go @@ -283,8 +283,8 @@ func (s *MattermostAuthLayer) getQueryBuilder() sq.StatementBuilderType { func (s *MattermostAuthLayer) GetUsersByWorkspace(workspaceID string) ([]*model.User, error) { query := s.getQueryBuilder(). - Select("id", "username", "email", "password", "MFASecret as mfa_secret", "AuthService as auth_service", "COALESCE(AuthData, '') as auth_data", - "props", "Users.CreateAt as create_at", "Users.UpdateAt as update_at", "Users.DeleteAt as delete_at", "b.UserId IS NOT NULL AS is_bot"). + Select("id", "username", "props", + "Users.CreateAt as create_at", "Users.UpdateAt as update_at", "Users.DeleteAt as delete_at", "b.UserId IS NOT NULL AS is_bot"). From("Users"). Join("ChannelMembers ON ChannelMembers.UserID = Users.ID"). LeftJoin("Bots b ON ( b.UserId = Users.ID )"). @@ -315,11 +315,6 @@ func (s *MattermostAuthLayer) usersFromRows(rows *sql.Rows) ([]*model.User, erro err := rows.Scan( &user.ID, &user.Username, - &user.Email, - &user.Password, - &user.MfaSecret, - &user.AuthService, - &user.AuthData, &propsBytes, &user.CreateAt, &user.UpdateAt,