[MM-53086] Remove SendWelcomePost A/B test and feature (#23733)

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Julien Tant
2023-06-16 12:13:23 -07:00
коммит произвёл GitHub
родитель de61b9b687
Коммит 86f0877799
20 изменённых файлов: 1 добавлений и 474 удалений

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

@@ -11404,24 +11404,6 @@ func (s *OpenTracingLayerUserStore) GetEtagForProfilesNotInTeam(teamID string) s
return result
}
func (s *OpenTracingLayerUserStore) GetFirstSystemAdminID() (string, error) {
origCtx := s.Root.Store.Context()
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "UserStore.GetFirstSystemAdminID")
s.Root.Store.SetContext(newCtx)
defer func() {
s.Root.Store.SetContext(origCtx)
}()
defer span.Finish()
result, err := s.UserStore.GetFirstSystemAdminID()
if err != nil {
span.LogFields(spanlog.Error(err))
ext.Error.Set(span, true)
}
return result, err
}
func (s *OpenTracingLayerUserStore) GetForLogin(loginID string, allowSignInWithUsername bool, allowSignInWithEmail bool) (*model.User, error) {
origCtx := s.Root.Store.Context()
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "UserStore.GetForLogin")

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

@@ -13010,27 +13010,6 @@ func (s *RetryLayerUserStore) GetEtagForProfilesNotInTeam(teamID string) string
}
func (s *RetryLayerUserStore) GetFirstSystemAdminID() (string, error) {
tries := 0
for {
result, err := s.UserStore.GetFirstSystemAdminID()
if err == nil {
return result, nil
}
if !isRepeatableError(err) {
return result, err
}
tries++
if tries >= 3 {
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
return result, err
}
timepkg.Sleep(100 * timepkg.Millisecond)
}
}
func (s *RetryLayerUserStore) GetForLogin(loginID string, allowSignInWithUsername bool, allowSignInWithEmail bool) (*model.User, error) {
tries := 0

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

@@ -1746,16 +1746,6 @@ func (us SqlUserStore) InferSystemInstallDate() (int64, error) {
return createAt, nil
}
func (us SqlUserStore) GetFirstSystemAdminID() (string, error) {
var id string
err := us.GetReplicaX().Get(&id, "SELECT Id FROM Users WHERE Roles LIKE ? ORDER BY CreateAt ASC LIMIT 1", "%system_admin%")
if err != nil {
return "", errors.Wrap(err, "failed to get first system admin")
}
return id, nil
}
func (us SqlUserStore) GetUsersBatchForIndexing(startTime int64, startFileID string, limit int) ([]*model.UserForIndexing, error) {
users := []*model.User{}
usersQuery, args, err := us.usersQuery.

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

@@ -487,7 +487,6 @@ type UserStore interface {
IsEmpty(excludeBots bool) (bool, error)
GetUsersWithInvalidEmails(page int, perPage int, restrictedDomains string) ([]*model.User, error)
InsertUsers(users []*model.User) error
GetFirstSystemAdminID() (string, error)
}
type BotStore interface {

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

@@ -635,30 +635,6 @@ func (_m *UserStore) GetEtagForProfilesNotInTeam(teamID string) string {
return r0
}
// GetFirstSystemAdminID provides a mock function with given fields:
func (_m *UserStore) GetFirstSystemAdminID() (string, error) {
ret := _m.Called()
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func() (string, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetForLogin provides a mock function with given fields: loginID, allowSignInWithUsername, allowSignInWithEmail
func (_m *UserStore) GetForLogin(loginID string, allowSignInWithUsername bool, allowSignInWithEmail bool) (*model.User, error) {
ret := _m.Called(loginID, allowSignInWithUsername, allowSignInWithEmail)

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

@@ -94,7 +94,6 @@ func TestUserStore(t *testing.T, ss store.Store, s SqlStore) {
t.Run("ResetLastPictureUpdate", func(t *testing.T) { testUserStoreResetLastPictureUpdate(t, ss) })
t.Run("GetKnownUsers", func(t *testing.T) { testGetKnownUsers(t, ss) })
t.Run("GetUsersWithInvalidEmails", func(t *testing.T) { testGetUsersWithInvalidEmails(t, ss) })
t.Run("GetFirstSystemAdminID", func(t *testing.T) { testUserStoreGetFirstSystemAdminID(t, ss) })
}
func testUserStoreSave(t *testing.T, ss store.Store) {
@@ -4194,30 +4193,6 @@ func testCount(t *testing.T, ss store.Store) {
}
}
func testUserStoreGetFirstSystemAdminID(t *testing.T, ss store.Store) {
sysAdmin := &model.User{}
sysAdmin.Email = MakeEmail()
sysAdmin.Roles = model.SystemAdminRoleId + " " + model.SystemUserRoleId
sysAdmin, err := ss.User().Save(sysAdmin)
require.NoError(t, err)
defer func() { require.NoError(t, ss.User().PermanentDelete(sysAdmin.Id)) }()
// We need the second system admin to be created after the first one
// our granulirity is ms
time.Sleep(1 * time.Millisecond)
sysAdmin2 := &model.User{}
sysAdmin2.Email = MakeEmail()
sysAdmin2.Roles = model.SystemAdminRoleId + " " + model.SystemUserRoleId
sysAdmin2, err = ss.User().Save(sysAdmin2)
require.NoError(t, err)
defer func() { require.NoError(t, ss.User().PermanentDelete(sysAdmin2.Id)) }()
returnedId, err := ss.User().GetFirstSystemAdminID()
require.NoError(t, err)
require.Equal(t, sysAdmin.Id, returnedId)
}
func testUserStoreAnalyticsActiveCount(t *testing.T, ss store.Store, s SqlStore) {
cleanupStatusStore(t, s)

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

@@ -10272,22 +10272,6 @@ func (s *TimerLayerUserStore) GetEtagForProfilesNotInTeam(teamID string) string
return result
}
func (s *TimerLayerUserStore) GetFirstSystemAdminID() (string, error) {
start := time.Now()
result, err := s.UserStore.GetFirstSystemAdminID()
elapsed := float64(time.Since(start)) / float64(time.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetFirstSystemAdminID", success, elapsed)
}
return result, err
}
func (s *TimerLayerUserStore) GetForLogin(loginID string, allowSignInWithUsername bool, allowSignInWithEmail bool) (*model.User, error) {
start := time.Now()