[MM-61302] Use model.NewPointer throughout the code base (#28957)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
97c7c25820
Коммит
2424358b7d
@@ -206,9 +206,9 @@ func TestPatchBot(t *testing.T) {
|
||||
}()
|
||||
|
||||
botPatch := &model.BotPatch{
|
||||
Username: sToP("invalid username"),
|
||||
DisplayName: sToP("an updated bot"),
|
||||
Description: sToP("updated bot"),
|
||||
Username: model.NewPointer("invalid username"),
|
||||
DisplayName: model.NewPointer("an updated bot"),
|
||||
Description: model.NewPointer("updated bot"),
|
||||
}
|
||||
|
||||
_, err = th.App.PatchBot(th.Context, bot.UserId, botPatch)
|
||||
@@ -232,9 +232,9 @@ func TestPatchBot(t *testing.T) {
|
||||
}()
|
||||
|
||||
botPatch := &model.BotPatch{
|
||||
Username: sToP("username"),
|
||||
DisplayName: sToP("display name"),
|
||||
Description: sToP(strings.Repeat("x", 1025)),
|
||||
Username: model.NewPointer("username"),
|
||||
DisplayName: model.NewPointer("display name"),
|
||||
Description: model.NewPointer(strings.Repeat("x", 1025)),
|
||||
}
|
||||
|
||||
_, err = th.App.PatchBot(th.Context, bot.UserId, botPatch)
|
||||
@@ -261,9 +261,9 @@ func TestPatchBot(t *testing.T) {
|
||||
}()
|
||||
|
||||
botPatch := &model.BotPatch{
|
||||
Username: sToP("username2"),
|
||||
DisplayName: sToP("updated bot"),
|
||||
Description: sToP("an updated bot"),
|
||||
Username: model.NewPointer("username2"),
|
||||
DisplayName: model.NewPointer("updated bot"),
|
||||
Description: model.NewPointer("an updated bot"),
|
||||
}
|
||||
|
||||
patchedBot, err := th.App.PatchBot(th.Context, createdBot.UserId, botPatch)
|
||||
@@ -296,7 +296,7 @@ func TestPatchBot(t *testing.T) {
|
||||
}()
|
||||
|
||||
botPatch := &model.BotPatch{
|
||||
Username: sToP(th.BasicUser2.Username),
|
||||
Username: model.NewPointer(th.BasicUser2.Username),
|
||||
}
|
||||
|
||||
_, err = th.App.PatchBot(th.Context, bot.UserId, botPatch)
|
||||
@@ -927,7 +927,3 @@ func TestGetSystemBot(t *testing.T) {
|
||||
require.Equal(t, bot.UserId, botUser.Id)
|
||||
})
|
||||
}
|
||||
|
||||
func sToP(s string) *string {
|
||||
return &s
|
||||
}
|
||||
|
||||
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@@ -23,22 +23,6 @@ import (
|
||||
"github.com/mattermost/mattermost/server/v8/channels/utils/fileutils"
|
||||
)
|
||||
|
||||
func ptrStr(s string) *string {
|
||||
return &s
|
||||
}
|
||||
|
||||
func ptrInt64(i int64) *int64 {
|
||||
return &i
|
||||
}
|
||||
|
||||
func ptrInt(i int) *int {
|
||||
return &i
|
||||
}
|
||||
|
||||
func ptrBool(b bool) *bool {
|
||||
return &b
|
||||
}
|
||||
|
||||
func checkPreference(t *testing.T, a *App, userID string, category string, name string, value string) {
|
||||
preferences, err := a.Srv().Store().Preference().GetCategory(userID, category)
|
||||
require.NoErrorf(t, err, "Failed to get preferences for user %v with category %v", userID, category)
|
||||
@@ -250,7 +234,7 @@ func TestImportBulkImport(t *testing.T) {
|
||||
func TestImportProcessImportDataFileVersionLine(t *testing.T) {
|
||||
data := imports.LineImportData{
|
||||
Type: "version",
|
||||
Version: ptrInt(1),
|
||||
Version: model.NewPointer(1),
|
||||
}
|
||||
version, err := processImportDataFileVersionLine(data)
|
||||
require.Nil(t, err, "Expected no error")
|
||||
|
||||
@@ -2992,7 +2992,7 @@ func TestCollapsedThreadFetch(t *testing.T) {
|
||||
Email: "success+" + id + "@simulator.amazonses.com",
|
||||
Username: "un_" + id,
|
||||
Nickname: "nn_" + id,
|
||||
AuthData: ptrStr("bobbytables"),
|
||||
AuthData: model.NewPointer("bobbytables"),
|
||||
AuthService: "saml",
|
||||
EmailVerified: true,
|
||||
})
|
||||
|
||||
Ссылка в новой задаче
Block a user