Run gofmt -s against codebase (#12943)
Этот коммит содержится в:
@@ -14,10 +14,10 @@ import (
|
||||
|
||||
func createAudit(ss store.Store, userId, sessionId string) *model.Audit {
|
||||
audit := model.Audit{
|
||||
UserId: userId,
|
||||
UserId: userId,
|
||||
SessionId: sessionId,
|
||||
IpAddress: "ipaddress",
|
||||
Action: "Action",
|
||||
Action: "Action",
|
||||
}
|
||||
ss.Audit().Save(&audit)
|
||||
return &audit
|
||||
@@ -46,7 +46,7 @@ func createChannelWithSchemeId(ss store.Store, schemeId *string) *model.Channel
|
||||
return c
|
||||
}
|
||||
|
||||
func createCommand(ss store.Store, userId, teamId string) * model.Command {
|
||||
func createCommand(ss store.Store, userId, teamId string) *model.Command {
|
||||
m := model.Command{}
|
||||
m.CreatorId = userId
|
||||
m.Method = model.COMMAND_METHOD_POST
|
||||
@@ -75,19 +75,19 @@ func createChannelMemberHistory(ss store.Store, channelId, userId string) *model
|
||||
}
|
||||
|
||||
func createChannelWithTeamId(ss store.Store, id string) *model.Channel {
|
||||
return createChannel(ss, id, model.NewId());
|
||||
return createChannel(ss, id, model.NewId())
|
||||
}
|
||||
|
||||
func createChannelWithCreatorId(ss store.Store, id string) *model.Channel {
|
||||
return createChannel(ss, model.NewId(), id);
|
||||
return createChannel(ss, model.NewId(), id)
|
||||
}
|
||||
|
||||
func createChannelMemberWithChannelId(ss store.Store, id string) *model.ChannelMember {
|
||||
return createChannelMember(ss, id, model.NewId());
|
||||
return createChannelMember(ss, id, model.NewId())
|
||||
}
|
||||
|
||||
func createChannelMemberWithUserId(ss store.Store, id string) *model.ChannelMember {
|
||||
return createChannelMember(ss, model.NewId(), id);
|
||||
return createChannelMember(ss, model.NewId(), id)
|
||||
}
|
||||
|
||||
func createCommandWebhook(ss store.Store, commandId, userId, channelId string) *model.CommandWebhook {
|
||||
@@ -192,20 +192,20 @@ func createPost(ss store.Store, channelId, userId, rootId, parentId string) *mod
|
||||
}
|
||||
|
||||
func createPostWithChannelId(ss store.Store, id string) *model.Post {
|
||||
return createPost(ss, id, model.NewId(), "", "");
|
||||
return createPost(ss, id, model.NewId(), "", "")
|
||||
}
|
||||
|
||||
func createPostWithUserId(ss store.Store, id string) *model.Post {
|
||||
return createPost(ss, model.NewId(), id, "", "");
|
||||
return createPost(ss, model.NewId(), id, "", "")
|
||||
}
|
||||
|
||||
func createPreferences(ss store.Store, userId string) *model.Preferences {
|
||||
preferences := model.Preferences{
|
||||
{
|
||||
UserId: userId,
|
||||
Name: model.NewId(),
|
||||
UserId: userId,
|
||||
Name: model.NewId(),
|
||||
Category: model.PREFERENCE_CATEGORY_DIRECT_CHANNEL_SHOW,
|
||||
Value: "somevalue",
|
||||
Value: "somevalue",
|
||||
},
|
||||
}
|
||||
ss.Preference().Save(&preferences)
|
||||
@@ -369,10 +369,10 @@ func TestCheckParentChildIntegrity(t *testing.T) {
|
||||
supplier := ss.(*store.LayeredStore).DatabaseLayer.(*SqlSupplier)
|
||||
t.Run("should receive an error", func(t *testing.T) {
|
||||
config := relationalCheckConfig{
|
||||
parentName: "NotValid",
|
||||
parentName: "NotValid",
|
||||
parentIdAttr: "NotValid",
|
||||
childName: "NotValid",
|
||||
childIdAttr: "NotValid",
|
||||
childName: "NotValid",
|
||||
childIdAttr: "NotValid",
|
||||
}
|
||||
result := checkParentChildIntegrity(supplier, config)
|
||||
require.NotNil(t, result.Err)
|
||||
@@ -402,7 +402,7 @@ func TestCheckChannelsCommandWebhooksIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: channelId,
|
||||
ChildId: cwh.Id,
|
||||
ChildId: cwh.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(cwh)
|
||||
})
|
||||
@@ -488,7 +488,7 @@ func TestCheckChannelsIncomingWebhooksIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: channelId,
|
||||
ChildId: wh.Id,
|
||||
ChildId: wh.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(wh)
|
||||
})
|
||||
@@ -518,7 +518,7 @@ func TestCheckChannelsOutgoingWebhooksIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: channelId,
|
||||
ChildId: wh.Id,
|
||||
ChildId: wh.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(wh)
|
||||
})
|
||||
@@ -545,7 +545,7 @@ func TestCheckChannelsPostsIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: post.ChannelId,
|
||||
ChildId: post.Id,
|
||||
ChildId: post.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(post)
|
||||
})
|
||||
@@ -573,7 +573,7 @@ func TestCheckCommandsCommandWebhooksIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: commandId,
|
||||
ChildId: cwh.Id,
|
||||
ChildId: cwh.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(cwh)
|
||||
})
|
||||
@@ -631,7 +631,7 @@ func TestCheckPostsPostsParentIdIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: parentId,
|
||||
ChildId: post.Id,
|
||||
ChildId: post.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(root)
|
||||
dbmap.Delete(post)
|
||||
@@ -662,7 +662,7 @@ func TestCheckPostsPostsRootIdIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: rootId,
|
||||
ChildId: post.Id,
|
||||
ChildId: post.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(post)
|
||||
})
|
||||
@@ -720,7 +720,7 @@ func TestCheckSchemesChannelsIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: schemeId,
|
||||
ChildId: channel.Id,
|
||||
ChildId: channel.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(channel)
|
||||
})
|
||||
@@ -751,7 +751,7 @@ func TestCheckSchemesTeamsIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: schemeId,
|
||||
ChildId: team.Id,
|
||||
ChildId: team.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(team)
|
||||
})
|
||||
@@ -782,7 +782,7 @@ func TestCheckSessionsAuditsIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: sessionId,
|
||||
ChildId: audit.Id,
|
||||
ChildId: audit.Id,
|
||||
}, data.Records[0])
|
||||
ss.Audit().PermanentDeleteByUser(userId)
|
||||
})
|
||||
@@ -809,7 +809,7 @@ func TestCheckTeamsChannelsIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: channel.TeamId,
|
||||
ChildId: channel.Id,
|
||||
ChildId: channel.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(channel)
|
||||
})
|
||||
@@ -837,7 +837,7 @@ func TestCheckTeamsCommandsIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: teamId,
|
||||
ChildId: cmd.Id,
|
||||
ChildId: cmd.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(cmd)
|
||||
})
|
||||
@@ -865,7 +865,7 @@ func TestCheckTeamsIncomingWebhooksIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: teamId,
|
||||
ChildId: wh.Id,
|
||||
ChildId: wh.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(wh)
|
||||
})
|
||||
@@ -893,7 +893,7 @@ func TestCheckTeamsOutgoingWebhooksIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: teamId,
|
||||
ChildId: wh.Id,
|
||||
ChildId: wh.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(wh)
|
||||
})
|
||||
@@ -951,7 +951,7 @@ func TestCheckUsersAuditsIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: userId,
|
||||
ChildId: audit.Id,
|
||||
ChildId: audit.Id,
|
||||
}, data.Records[0])
|
||||
ss.Audit().PermanentDeleteByUser(userId)
|
||||
})
|
||||
@@ -979,7 +979,7 @@ func TestCheckUsersCommandWebhooksIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: userId,
|
||||
ChildId: cwh.Id,
|
||||
ChildId: cwh.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(cwh)
|
||||
})
|
||||
@@ -1006,7 +1006,7 @@ func TestCheckUsersChannelsIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: channel.CreatorId,
|
||||
ChildId: channel.Id,
|
||||
ChildId: channel.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(channel)
|
||||
})
|
||||
@@ -1094,7 +1094,7 @@ func TestCheckUsersCommandsIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: userId,
|
||||
ChildId: cmd.Id,
|
||||
ChildId: cmd.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(cmd)
|
||||
})
|
||||
@@ -1124,7 +1124,7 @@ func TestCheckUsersCompliancesIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: userId,
|
||||
ChildId: compliance.Id,
|
||||
ChildId: compliance.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(compliance)
|
||||
})
|
||||
@@ -1154,7 +1154,7 @@ func TestCheckUsersEmojiIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: userId,
|
||||
ChildId: emoji.Id,
|
||||
ChildId: emoji.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(emoji)
|
||||
})
|
||||
@@ -1211,7 +1211,7 @@ func TestCheckUsersIncomingWebhooksIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: userId,
|
||||
ChildId: wh.Id,
|
||||
ChildId: wh.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(wh)
|
||||
})
|
||||
@@ -1241,7 +1241,7 @@ func TestCheckUsersOAuthAccessDataIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: userId,
|
||||
ChildId: ad.Token,
|
||||
ChildId: ad.Token,
|
||||
}, data.Records[0])
|
||||
ss.OAuth().RemoveAccessData(ad.Token)
|
||||
})
|
||||
@@ -1271,7 +1271,7 @@ func TestCheckUsersOAuthAppsIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: userId,
|
||||
ChildId: app.Id,
|
||||
ChildId: app.Id,
|
||||
}, data.Records[0])
|
||||
ss.OAuth().DeleteApp(app.Id)
|
||||
})
|
||||
@@ -1301,7 +1301,7 @@ func TestCheckUsersOAuthAuthDataIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: userId,
|
||||
ChildId: ad.Code,
|
||||
ChildId: ad.Code,
|
||||
}, data.Records[0])
|
||||
ss.OAuth().RemoveAuthData(ad.Code)
|
||||
})
|
||||
@@ -1329,7 +1329,7 @@ func TestCheckUsersOutgoingWebhooksIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: userId,
|
||||
ChildId: wh.Id,
|
||||
ChildId: wh.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(wh)
|
||||
})
|
||||
@@ -1356,7 +1356,7 @@ func TestCheckUsersPostsIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: post.UserId,
|
||||
ChildId: post.Id,
|
||||
ChildId: post.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(post)
|
||||
})
|
||||
@@ -1442,7 +1442,7 @@ func TestCheckUsersSessionsIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: userId,
|
||||
ChildId: session.Id,
|
||||
ChildId: session.Id,
|
||||
}, data.Records[0])
|
||||
dbmap.Delete(session)
|
||||
})
|
||||
@@ -1531,7 +1531,7 @@ func TestCheckUsersUserAccessTokensIntegrity(t *testing.T) {
|
||||
require.Len(t, data.Records, 1)
|
||||
require.Equal(t, store.OrphanedRecord{
|
||||
ParentId: userId,
|
||||
ChildId: uat.Id,
|
||||
ChildId: uat.Id,
|
||||
}, data.Records[0])
|
||||
ss.UserAccessToken().Delete(uat.Id)
|
||||
})
|
||||
|
||||
Ссылка в новой задаче
Block a user