Add whitespace linter (#24855)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
176370e175
Коммит
0d5a8b8841
@@ -157,7 +157,6 @@ func (s LocalCacheChannelStore) GetPinnedPostCount(channelId string, allowFromCa
|
||||
}
|
||||
|
||||
func (s LocalCacheChannelStore) Get(id string, allowFromCache bool) (*model.Channel, error) {
|
||||
|
||||
if allowFromCache {
|
||||
var cacheItem *model.Channel
|
||||
if err := s.rootStore.doStandardReadCache(s.rootStore.channelByIdCache, id, &cacheItem); err == nil {
|
||||
|
||||
@@ -190,6 +190,5 @@ func TestPostStoreCache(t *testing.T) {
|
||||
|
||||
_, _ = cachedStore.Post().GetPosts(fakeOptions, true, map[string]bool{})
|
||||
mockStore.Post().(*mocks.PostStore).AssertNumberOfCalls(t, "GetPosts", 1)
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@@ -73,5 +73,4 @@ func TestTeamStoreCache(t *testing.T) {
|
||||
assert.Equal(t, fakeUserTeamIds, gotUserTeamIds)
|
||||
mockStore.Team().(*mocks.TeamStore).AssertNumberOfCalls(t, "GetUserTeamIds", 2)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ func TestTermsOfServiceStore(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTermsOfServiceStoreTermsOfServiceCache(t *testing.T) {
|
||||
|
||||
fakeTermsOfService := model.TermsOfService{Id: "123", CreateAt: 11111, UserId: "321", Text: "Terms of service test"}
|
||||
|
||||
t.Run("first call by latest not cached, second cached and returning same data", func(t *testing.T) {
|
||||
|
||||
@@ -1592,7 +1592,6 @@ func testFileInfoSupportWildcardOutsideQuotes(t *testing.T, th *SearchTestHelper
|
||||
require.Len(t, results.FileInfos, 1)
|
||||
th.checkFileInfoInSearchResults(t, p2.Id, results.FileInfos)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func testFileInfoSlashShouldNotBeCharSeparator(t *testing.T, th *SearchTestHelper) {
|
||||
|
||||
@@ -326,7 +326,6 @@ func (th *SearchTestHelper) createGroupChannel(teamID, displayName string, users
|
||||
}
|
||||
|
||||
return channel, nil
|
||||
|
||||
}
|
||||
|
||||
func (th *SearchTestHelper) deleteChannel(channel *model.Channel) error {
|
||||
|
||||
@@ -1767,7 +1767,6 @@ func testSupportWildcardOutsideQuotes(t *testing.T, th *SearchTestHelper) {
|
||||
require.Len(t, results.Posts, 1)
|
||||
th.checkPostInSearchResults(t, p2.Id, results.Posts)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func testHashtagSearchShouldSupportThreeOrMoreCharacters(t *testing.T, th *SearchTestHelper) {
|
||||
|
||||
@@ -60,7 +60,6 @@ func runTestSearch(t *testing.T, testEngine *SearchTestEngine, tests []searchTes
|
||||
filteredTests := filterTestsByTag(tests, testEngine.Driver)
|
||||
|
||||
for _, test := range filteredTests {
|
||||
|
||||
if test.Skip {
|
||||
t.Log("SKIPPED: " + test.Name + ". Reason: " + test.SkipMessage)
|
||||
continue
|
||||
|
||||
@@ -683,7 +683,6 @@ func (s SqlChannelStore) SaveDirectChannel(directChannel *model.Channel, member1
|
||||
}
|
||||
|
||||
return newChannel, nil
|
||||
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) saveChannelT(transaction *sqlxTxWrapper, channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error) {
|
||||
@@ -2971,7 +2970,6 @@ func (s SqlChannelStore) GetForPost(postId string) (*model.Channel, error) {
|
||||
Channels.Id = Posts.ChannelId
|
||||
AND Posts.Id = ?`, postId); err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to get Channel with postId=%s", postId)
|
||||
|
||||
}
|
||||
return &channel, nil
|
||||
}
|
||||
@@ -3526,7 +3524,6 @@ func (s SqlChannelStore) channelSearchQuery(opts *store.ChannelSearchOpts) sq.Se
|
||||
query = query.
|
||||
LeftJoin("RetentionPoliciesChannels ON c.Id = RetentionPoliciesChannels.ChannelId").
|
||||
Where("RetentionPoliciesChannels.ChannelId IS NULL")
|
||||
|
||||
} else {
|
||||
query = query.Where(sq.Expr(`c.Id NOT IN (SELECT ChannelId FROM RetentionPoliciesChannels)`))
|
||||
}
|
||||
@@ -3770,7 +3767,6 @@ func (s SqlChannelStore) buildFulltextClauseX(term string, searchColumns ...stri
|
||||
|
||||
expr := fmt.Sprintf("((to_tsvector('%[1]s', %[2]s)) @@ to_tsquery('%[1]s', ?))", s.pgDefaultTextSearchConfig, strings.Join(searchColumns, " || ' ' || "))
|
||||
return sq.Expr(expr, fulltextTerm)
|
||||
|
||||
}
|
||||
|
||||
splitTerm := strings.Fields(fulltextTerm)
|
||||
@@ -3846,7 +3842,6 @@ func (s SqlChannelStore) searchGroupChannelsQuery(userId, term string, isPostgre
|
||||
return s.getQueryBuilder().Select("*").
|
||||
From("Channels").
|
||||
Where(sq.Expr("Id IN (?)", subq))
|
||||
|
||||
}
|
||||
|
||||
baseLikeTerm = "GROUP_CONCAT(u.Username SEPARATOR ', ') LIKE ?"
|
||||
@@ -4067,7 +4062,6 @@ func (s SqlChannelStore) MigrateChannelMembers(fromChannelId string, fromUserId
|
||||
WHERE ChannelId=:ChannelId AND UserId=:UserId`, &member); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to update ChannelMember")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if err := transaction.Commit(); err != nil {
|
||||
|
||||
@@ -421,7 +421,6 @@ func TestCheckChannelsCommandWebhooksIntegrity(t *testing.T) {
|
||||
require.NoError(t, result.Err)
|
||||
data := result.Data.(model.RelationalIntegrityCheckData)
|
||||
require.Empty(t, data.Records)
|
||||
|
||||
})
|
||||
t.Run("should generate a report with one record", func(t *testing.T) {
|
||||
channelId := model.NewId()
|
||||
|
||||
@@ -53,7 +53,6 @@ func (ls SqlLicenseStore) Save(license *model.LicenseRecord) error {
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
// Get obtains the license with the provided id parameter from the database.
|
||||
|
||||
@@ -637,7 +637,6 @@ func (s *SqlPostStore) getPostWithCollapsedThreads(id, userID string, opts model
|
||||
sq.Lt{"Posts.Id": opts.FromPost},
|
||||
},
|
||||
})
|
||||
|
||||
} else {
|
||||
query = query.Where(direction)
|
||||
}
|
||||
@@ -759,7 +758,6 @@ func (s *SqlPostStore) Get(ctx context.Context, id string, opts model.GetPostsOp
|
||||
sq.Lt{"p.Id": opts.FromPost},
|
||||
},
|
||||
})
|
||||
|
||||
} else {
|
||||
query = query.Where(direction)
|
||||
}
|
||||
@@ -2220,7 +2218,6 @@ func (s *SqlPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.A
|
||||
|
||||
// TODO: convert to squirrel HW
|
||||
func (s *SqlPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, error) {
|
||||
|
||||
var args []any
|
||||
query :=
|
||||
`SELECT
|
||||
|
||||
@@ -172,7 +172,6 @@ func (s SqlPreferenceStore) GetCategory(userId string, category string) (model.P
|
||||
return nil, errors.Wrapf(err, "failed to find Preference with userId=%s, category=%s", userId, category)
|
||||
}
|
||||
return preferences, nil
|
||||
|
||||
}
|
||||
|
||||
func (s SqlPreferenceStore) GetAll(userId string) (model.Preferences, error) {
|
||||
@@ -205,7 +204,6 @@ func (s SqlPreferenceStore) PermanentDeleteByUser(userId string) error {
|
||||
}
|
||||
|
||||
func (s SqlPreferenceStore) Delete(userId, category, name string) error {
|
||||
|
||||
sql, args, err := s.getQueryBuilder().
|
||||
Delete("Preferences").
|
||||
Where(sq.Eq{"UserId": userId}).
|
||||
@@ -224,7 +222,6 @@ func (s SqlPreferenceStore) Delete(userId, category, name string) error {
|
||||
}
|
||||
|
||||
func (s SqlPreferenceStore) DeleteCategory(userId string, category string) error {
|
||||
|
||||
sql, args, err := s.getQueryBuilder().
|
||||
Delete("Preferences").
|
||||
Where(sq.Eq{"UserId": userId}).
|
||||
|
||||
@@ -440,7 +440,6 @@ func (ss *SqlStore) GetDbVersion(numerical bool) (string, error) {
|
||||
}
|
||||
|
||||
return version, nil
|
||||
|
||||
}
|
||||
|
||||
func (ss *SqlStore) GetMasterX() *sqlxDBWrapper {
|
||||
@@ -654,7 +653,6 @@ func (ss *SqlStore) DoesTableExist(tableName string) bool {
|
||||
}
|
||||
|
||||
return count > 0
|
||||
|
||||
} else if ss.DriverName() == model.DatabaseDriverMysql {
|
||||
var count int64
|
||||
err := ss.GetMasterX().Get(&count,
|
||||
@@ -674,7 +672,6 @@ func (ss *SqlStore) DoesTableExist(tableName string) bool {
|
||||
}
|
||||
|
||||
return count > 0
|
||||
|
||||
} else {
|
||||
mlog.Fatal("Failed to check if column exists because of missing driver")
|
||||
return false
|
||||
@@ -703,7 +700,6 @@ func (ss *SqlStore) DoesColumnExist(tableName string, columnName string) bool {
|
||||
}
|
||||
|
||||
return count > 0
|
||||
|
||||
} else if ss.DriverName() == model.DatabaseDriverMysql {
|
||||
var count int64
|
||||
err := ss.GetMasterX().Get(&count,
|
||||
@@ -724,7 +720,6 @@ func (ss *SqlStore) DoesColumnExist(tableName string, columnName string) bool {
|
||||
}
|
||||
|
||||
return count > 0
|
||||
|
||||
} else {
|
||||
mlog.Fatal("Failed to check if column exists because of missing driver")
|
||||
return false
|
||||
@@ -748,7 +743,6 @@ func (ss *SqlStore) DoesTriggerExist(triggerName string) bool {
|
||||
}
|
||||
|
||||
return count > 0
|
||||
|
||||
} else if ss.DriverName() == model.DatabaseDriverMysql {
|
||||
var count int64
|
||||
err := ss.GetMasterX().Get(&count, `
|
||||
@@ -766,7 +760,6 @@ func (ss *SqlStore) DoesTriggerExist(triggerName string) bool {
|
||||
}
|
||||
|
||||
return count > 0
|
||||
|
||||
} else {
|
||||
mlog.Fatal("Failed to check if column exists because of missing driver")
|
||||
return false
|
||||
@@ -774,7 +767,6 @@ func (ss *SqlStore) DoesTriggerExist(triggerName string) bool {
|
||||
}
|
||||
|
||||
func (ss *SqlStore) CreateColumnIfNotExists(tableName string, columnName string, mySqlColType string, postgresColType string, defaultValue string) bool {
|
||||
|
||||
if ss.DoesColumnExist(tableName, columnName) {
|
||||
return false
|
||||
}
|
||||
@@ -786,7 +778,6 @@ func (ss *SqlStore) CreateColumnIfNotExists(tableName string, columnName string,
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
} else if ss.DriverName() == model.DatabaseDriverMysql {
|
||||
_, err := ss.GetMasterX().ExecNoTimeout("ALTER TABLE " + tableName + " ADD " + columnName + " " + mySqlColType + " DEFAULT '" + defaultValue + "'")
|
||||
if err != nil {
|
||||
@@ -794,7 +785,6 @@ func (ss *SqlStore) CreateColumnIfNotExists(tableName string, columnName string,
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
} else {
|
||||
mlog.Fatal("Failed to create column because of missing driver")
|
||||
return false
|
||||
@@ -1106,7 +1096,6 @@ func (ss *SqlStore) DropAllTables() {
|
||||
for _, t := range tables {
|
||||
if t != "db_migrations" {
|
||||
ss.masterX.Exec(`TRUNCATE TABLE ` + t)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +310,6 @@ func TestGetReplica(t *testing.T) {
|
||||
for replica := range replicas {
|
||||
assert.NotSame(t, store.GetMasterX(), replica)
|
||||
}
|
||||
|
||||
} else if assert.Len(t, replicas, 1) {
|
||||
// Otherwise ensure the replicas contains only the master.
|
||||
for replica := range replicas {
|
||||
@@ -382,7 +381,6 @@ func TestGetReplica(t *testing.T) {
|
||||
for replica := range replicas {
|
||||
assert.Same(t, store.GetMasterX(), replica)
|
||||
}
|
||||
|
||||
} else if assert.Len(t, replicas, 1) {
|
||||
// Otherwise ensure the replicas contains only the master.
|
||||
for replica := range replicas {
|
||||
@@ -397,7 +395,6 @@ func TestGetReplica(t *testing.T) {
|
||||
for searchReplica := range searchReplicas {
|
||||
assert.Same(t, store.GetMasterX(), searchReplica)
|
||||
}
|
||||
|
||||
} else if testCase.DataSourceReplicaNum > 0 {
|
||||
assert.Equal(t, len(replicas), len(searchReplicas))
|
||||
for k := range replicas {
|
||||
@@ -567,7 +564,6 @@ func TestIsBinaryParamEnabled(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, tests[i].expected, ok)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestGetAllConns(t *testing.T) {
|
||||
|
||||
@@ -248,7 +248,6 @@ func (s SqlTeamStore) Save(team *model.Team) (*model.Team, error) {
|
||||
// if the team exists in the database.
|
||||
// It returns the updated team if the operation is successful.
|
||||
func (s SqlTeamStore) Update(team *model.Team) (*model.Team, error) {
|
||||
|
||||
team.PreUpdate()
|
||||
|
||||
if err := team.IsValid(); err != nil {
|
||||
@@ -259,7 +258,6 @@ func (s SqlTeamStore) Update(team *model.Team) (*model.Team, error) {
|
||||
err := s.GetMasterX().Get(&oldTeam, `SELECT * FROM Teams WHERE Id=?`, team.Id)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to get Team with id=%s", team.Id)
|
||||
|
||||
}
|
||||
|
||||
if oldTeam.Id == "" {
|
||||
@@ -365,7 +363,6 @@ func (s SqlTeamStore) GetByEmptyInviteID() ([]*model.Team, error) {
|
||||
// If there is no match in the database, it returns a model.AppError with a
|
||||
// http.StatusNotFound in the StatusCode field.
|
||||
func (s SqlTeamStore) GetByName(name string) (*model.Team, error) {
|
||||
|
||||
team := model.Team{}
|
||||
query, args, err := s.teamsQuery.Where(sq.Eq{"Name": name}).ToSql()
|
||||
if err != nil {
|
||||
@@ -1337,7 +1334,6 @@ func (s SqlTeamStore) MigrateTeamMembers(fromTeamId string, fromUserId string) (
|
||||
WHERE TeamId=:TeamId AND UserId=:UserId`, &member); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to update TeamMember")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if err := transaction.Commit(); err != nil {
|
||||
@@ -1369,7 +1365,6 @@ func (s SqlTeamStore) InvalidateAllTeamIdsForUser(userId string) {}
|
||||
|
||||
// ClearAllCustomRoleAssignments removes all custom role assignments from TeamMembers.
|
||||
func (s SqlTeamStore) ClearAllCustomRoleAssignments() (err error) {
|
||||
|
||||
builtInRoles := model.MakeDefaultRoles()
|
||||
lastUserId := strings.Repeat("0", 26)
|
||||
lastTeamId := strings.Repeat("0", 26)
|
||||
|
||||
@@ -587,7 +587,6 @@ func (s *SqlThreadStore) MarkAllAsReadByChannels(userID string, channelIDs []str
|
||||
var query sq.UpdateBuilder
|
||||
if s.DriverName() == model.DatabaseDriverPostgres {
|
||||
query = s.getQueryBuilder().Update("ThreadMemberships").From("Threads")
|
||||
|
||||
} else {
|
||||
query = s.getQueryBuilder().Update("ThreadMemberships", "Threads")
|
||||
}
|
||||
|
||||
@@ -57,11 +57,9 @@ func (s SqlUserAccessTokenStore) Delete(tokenId string) (err error) {
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
func (s SqlUserAccessTokenStore) deleteSessionsAndTokensById(transaction *sqlxTxWrapper, tokenId string) error {
|
||||
|
||||
query := ""
|
||||
if s.DriverName() == model.DatabaseDriverPostgres {
|
||||
query = "DELETE FROM Sessions s USING UserAccessTokens o WHERE o.Token = s.Token AND o.Id = ?"
|
||||
@@ -77,7 +75,6 @@ func (s SqlUserAccessTokenStore) deleteSessionsAndTokensById(transaction *sqlxTx
|
||||
}
|
||||
|
||||
func (s SqlUserAccessTokenStore) deleteTokensById(transaction *sqlxTxWrapper, tokenId string) error {
|
||||
|
||||
if _, err := transaction.Exec("DELETE FROM UserAccessTokens WHERE Id = ?", tokenId); err != nil {
|
||||
return errors.Wrapf(err, "failed to delete UserAccessToken id=%s", tokenId)
|
||||
}
|
||||
|
||||
@@ -455,7 +455,6 @@ func (us SqlUserStore) Get(ctx context.Context, id string) (*model.User, error)
|
||||
return nil, store.NewErrNotFound("User", id)
|
||||
}
|
||||
return nil, errors.Wrapf(err, "failed to get User with userId=%s", id)
|
||||
|
||||
}
|
||||
if err = json.Unmarshal(props, &user.Props); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal user props")
|
||||
@@ -580,7 +579,6 @@ func applyMultiRoleFilters(query sq.SelectBuilder, systemRoles []string, teamRol
|
||||
sqOr = append(sqOr, sq.Like{"u.Roles": queryRole})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1304,7 +1302,6 @@ func (us SqlUserStore) GetForLogin(loginId string, allowSignInWithUsername, allo
|
||||
}
|
||||
|
||||
return users[0], nil
|
||||
|
||||
}
|
||||
|
||||
func (us SqlUserStore) VerifyEmail(userId, email string) (string, error) {
|
||||
@@ -1378,7 +1375,6 @@ func (us SqlUserStore) Count(options model.UserCountOptions) (int64, error) {
|
||||
}
|
||||
|
||||
func (us SqlUserStore) AnalyticsActiveCount(timePeriod int64, options model.UserCountOptions) (int64, error) {
|
||||
|
||||
time := model.GetMillis() - timePeriod
|
||||
query := us.getQueryBuilder().Select("COUNT(*)").From("Status AS s").Where("LastActivityAt > ?", time)
|
||||
|
||||
|
||||
@@ -131,7 +131,6 @@ func (s SqlWebhookStore) GetIncomingListByUser(userId string, offset, limit int)
|
||||
}
|
||||
|
||||
return webhooks, nil
|
||||
|
||||
}
|
||||
|
||||
func (s SqlWebhookStore) GetIncomingByTeamByUser(teamId string, userId string, offset, limit int) ([]*model.IncomingWebhook, error) {
|
||||
@@ -198,7 +197,6 @@ func (s SqlWebhookStore) SaveOutgoing(webhook *model.OutgoingWebhook) (*model.Ou
|
||||
}
|
||||
|
||||
func (s SqlWebhookStore) GetOutgoing(id string) (*model.OutgoingWebhook, error) {
|
||||
|
||||
var webhook model.OutgoingWebhook
|
||||
|
||||
if err := s.GetReplicaX().Get(&webhook, "SELECT * FROM OutgoingWebhooks WHERE Id = ? AND DeleteAt = 0", id); err != nil {
|
||||
@@ -240,7 +238,6 @@ func (s SqlWebhookStore) GetOutgoingListByUser(userId string, offset, limit int)
|
||||
|
||||
func (s SqlWebhookStore) GetOutgoingList(offset, limit int) ([]*model.OutgoingWebhook, error) {
|
||||
return s.GetOutgoingListByUser("", offset, limit)
|
||||
|
||||
}
|
||||
|
||||
func (s SqlWebhookStore) GetOutgoingByChannelByUser(channelId string, userId string, offset, limit int) ([]*model.OutgoingWebhook, error) {
|
||||
|
||||
@@ -680,7 +680,6 @@ func testGetChannelsWithTeamDataByIds(t *testing.T, ss store.Store) {
|
||||
}
|
||||
|
||||
func testChannelStoreGetForPost(t *testing.T, ss store.Store) {
|
||||
|
||||
ch := &model.Channel{
|
||||
TeamId: model.NewId(),
|
||||
DisplayName: "Name",
|
||||
@@ -1032,7 +1031,6 @@ func testChannelStoreGetDeleted(t *testing.T, ss store.Store) {
|
||||
list, nErr = ss.Channel().GetDeleted(o1.TeamId, 1, 1, userId)
|
||||
require.NoError(t, nErr, nErr)
|
||||
require.Len(t, list, 1, "wrong list length")
|
||||
|
||||
}
|
||||
|
||||
func testChannelMemberStore(t *testing.T, ss store.Store) {
|
||||
|
||||
@@ -241,7 +241,6 @@ func testEmojiGetList(t *testing.T, ss store.Store) {
|
||||
assert.Equal(t, 2, len(remojis))
|
||||
assert.Equal(t, emojis[1].Name, remojis[0].Name)
|
||||
assert.Equal(t, emojis[2].Name, remojis[1].Name)
|
||||
|
||||
}
|
||||
|
||||
func testEmojiSearch(t *testing.T, ss store.Store) {
|
||||
|
||||
@@ -221,7 +221,6 @@ func testFileInfoGetForPost(t *testing.T, ss store.Store) {
|
||||
)
|
||||
require.NoError(t, err)
|
||||
assert.Len(t, postInfos, tc.ExpectedPosts)
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1293,7 +1293,6 @@ func testPluginList(t *testing.T, ss store.Store) {
|
||||
if i%10 == 0 {
|
||||
// Expire keys 0, 10, 20, ...
|
||||
expireAt = 1
|
||||
|
||||
} else if (i+5)%10 == 0 {
|
||||
// Mark for future expiry keys 5, 15, 25, ...
|
||||
expireAt = now + 5*60*1000
|
||||
|
||||
@@ -20,7 +20,6 @@ func TestPostPriorityStore(t *testing.T, ss store.Store, s SqlStore) {
|
||||
}
|
||||
|
||||
func testPostPriorityStoreGetForPost(t *testing.T, ss store.Store) {
|
||||
|
||||
t.Run("Save post priority when in post's metadata", func(t *testing.T) {
|
||||
p1 := model.Post{}
|
||||
p1.ChannelId = model.NewId()
|
||||
|
||||
@@ -4402,7 +4402,6 @@ func testPostStoreGetRepliesForExport(t *testing.T, ss store.Store) {
|
||||
assert.Equal(t, reply1.Id, p2.Id)
|
||||
assert.Equal(t, reply1.Message, p2.Message)
|
||||
assert.Equal(t, reply1.Username, u1.Username)
|
||||
|
||||
}
|
||||
|
||||
func testPostStoreGetDirectPostParentsForExportAfter(t *testing.T, ss store.Store, s SqlStore) {
|
||||
@@ -5095,5 +5094,4 @@ func testGetEditHistoryForPost(t *testing.T, ss store.Store) {
|
||||
_, err = ss.Post().GetEditHistoryForPost(savedUpdatedPost.Id)
|
||||
require.NoError(t, err)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -191,7 +191,6 @@ func testPreferenceGetAll(t *testing.T, ss store.Store) {
|
||||
for i := 0; i < 3; i++ {
|
||||
assert.Falsef(t, result[0] != preferences[i] && result[1] != preferences[i] && result[2] != preferences[i], "got incorrect preferences")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func testPreferenceDeleteByUser(t *testing.T, ss store.Store) {
|
||||
|
||||
@@ -76,5 +76,4 @@ func testClearOld(t *testing.T, ss store.Store) {
|
||||
res, err := ss.ProductNotices().GetViews("testuser")
|
||||
require.NoError(t, err)
|
||||
require.Len(t, res, 1)
|
||||
|
||||
}
|
||||
|
||||
@@ -382,7 +382,6 @@ func testReactionGetForPostSince(t *testing.T, ss store.Store, s SqlStore) {
|
||||
for _, r := range returned {
|
||||
assert.Zero(t, r.DeleteAt, "should not have returned deleted reaction")
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
t.Run("reactions since, incl deleted", func(t *testing.T) {
|
||||
@@ -397,7 +396,6 @@ func testReactionGetForPostSince(t *testing.T, ss store.Store, s SqlStore) {
|
||||
}
|
||||
}
|
||||
assert.Equal(t, 1, count, "should not have returned 1 deleted reaction")
|
||||
|
||||
})
|
||||
|
||||
t.Run("reactions since, filter remoteId", func(t *testing.T) {
|
||||
@@ -561,7 +559,6 @@ func testReactionDeleteAllWithEmojiName(t *testing.T, ss store.Store, s SqlStore
|
||||
postList, err = ss.Post().Get(context.Background(), post3.Id, model.GetPostsOptions{}, "", map[string]bool{})
|
||||
require.NoError(t, err)
|
||||
assert.False(t, postList.Posts[post3.Id].HasReactions, "post shouldn't have reactions any more")
|
||||
|
||||
}
|
||||
|
||||
func testPermanentDeleteByUser(t *testing.T, ss store.Store) {
|
||||
@@ -805,7 +802,6 @@ func testReactionBulkGetForPosts(t *testing.T, ss store.Store) {
|
||||
}
|
||||
|
||||
require.False(t, post4IdFound, "Wrong reaction returned")
|
||||
|
||||
}
|
||||
|
||||
// testReactionDeadlock is a best-case attempt to recreate the deadlock scenario.
|
||||
|
||||
@@ -26,7 +26,6 @@ func TestRemoteClusterStore(t *testing.T, ss store.Store) {
|
||||
}
|
||||
|
||||
func testRemoteClusterSave(t *testing.T, ss store.Store) {
|
||||
|
||||
t.Run("Save", func(t *testing.T) {
|
||||
rc := &model.RemoteCluster{
|
||||
Name: "some_remote",
|
||||
|
||||
@@ -3198,7 +3198,6 @@ func testGetChannelUnreadsForTeam(t *testing.T, ss store.Store) {
|
||||
}
|
||||
|
||||
func testUpdateLastTeamIconUpdate(t *testing.T, ss store.Store) {
|
||||
|
||||
// team icon initially updated a second ago
|
||||
lastTeamIconUpdateInitial := model.GetMillis() - 1000
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ func TestThreadStore(t *testing.T, ss store.Store, s SqlStore) {
|
||||
|
||||
func testThreadStorePopulation(t *testing.T, ss store.Store) {
|
||||
makeSomePosts := func(urgent bool) []*model.Post {
|
||||
|
||||
u1 := model.User{
|
||||
Email: MakeEmail(),
|
||||
Username: model.NewId(),
|
||||
|
||||
@@ -21,7 +21,6 @@ func TestTrueUpReviewStatusStore(t *testing.T, ss store.Store, s SqlStore) {
|
||||
}
|
||||
|
||||
func testCreateTrueUpReviewStatus(t *testing.T, ss store.Store) {
|
||||
|
||||
now := time.Date(time.Now().Year(), time.January, 1, 0, 0, 0, 0, time.Local)
|
||||
|
||||
reviewStatus := model.TrueUpReviewStatus{
|
||||
@@ -39,7 +38,6 @@ func testCreateTrueUpReviewStatus(t *testing.T, ss store.Store) {
|
||||
}
|
||||
|
||||
func testGetTrueUpReviewStatus(t *testing.T, ss store.Store) {
|
||||
|
||||
now := time.Date(time.Now().Year(), time.August, 1, 0, 0, 0, 0, time.Local)
|
||||
dueDate := utils.GetNextTrueUpReviewDueDate(now).UnixMilli()
|
||||
|
||||
@@ -61,7 +59,6 @@ func testGetTrueUpReviewStatus(t *testing.T, ss store.Store) {
|
||||
}
|
||||
|
||||
func testUpdateTrueUpReviewStatus(t *testing.T, ss store.Store) {
|
||||
|
||||
now := time.Date(time.Now().Year(), time.April, 1, 0, 0, 0, 0, time.Local)
|
||||
|
||||
reviewStatus := model.TrueUpReviewStatus{
|
||||
|
||||
@@ -1035,7 +1035,6 @@ func testUserStoreGetProfilesInChannel(t *testing.T, ss store.Store) {
|
||||
}
|
||||
|
||||
func testUserStoreGetProfilesInChannelByAdmin(t *testing.T, ss store.Store, s SqlStore) {
|
||||
|
||||
cleanupStatusStore(t, s)
|
||||
|
||||
teamId := model.NewId()
|
||||
@@ -1114,7 +1113,6 @@ func testUserStoreGetProfilesInChannelByAdmin(t *testing.T, ss store.Store, s Sq
|
||||
}
|
||||
|
||||
func testUserStoreGetProfilesInChannelByStatus(t *testing.T, ss store.Store, s SqlStore) {
|
||||
|
||||
cleanupStatusStore(t, s)
|
||||
|
||||
teamId := model.NewId()
|
||||
@@ -2553,7 +2551,6 @@ func testUserStoreUpdateMfaActive(t *testing.T, ss store.Store) {
|
||||
}
|
||||
|
||||
func testUserStoreGetRecentlyActiveUsersForTeam(t *testing.T, ss store.Store, s SqlStore) {
|
||||
|
||||
cleanupStatusStore(t, s)
|
||||
|
||||
teamId := model.NewId()
|
||||
@@ -4268,7 +4265,6 @@ func testCount(t *testing.T, ss store.Store) {
|
||||
}
|
||||
|
||||
func testUserStoreAnalyticsActiveCount(t *testing.T, ss store.Store, s SqlStore) {
|
||||
|
||||
cleanupStatusStore(t, s)
|
||||
|
||||
// Create 5 users statuses u0, u1, u2, u3, u4.
|
||||
@@ -4353,7 +4349,6 @@ func testUserStoreAnalyticsActiveCount(t *testing.T, ss store.Store, s SqlStore)
|
||||
}
|
||||
|
||||
func testUserStoreAnalyticsActiveCountForPeriod(t *testing.T, ss store.Store, s SqlStore) {
|
||||
|
||||
cleanupStatusStore(t, s)
|
||||
|
||||
// Create 5 users statuses u0, u1, u2, u3, u4.
|
||||
@@ -4482,7 +4477,6 @@ func testUserStoreAnalyticsGetSystemAdminCount(t *testing.T, ss store.Store) {
|
||||
result, err := ss.User().AnalyticsGetSystemAdminCount()
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, countBefore+1, result, "Did not get the expected number of system admins.")
|
||||
|
||||
}
|
||||
|
||||
func testUserStoreAnalyticsGetGuestCount(t *testing.T, ss store.Store) {
|
||||
|
||||
@@ -53,7 +53,6 @@ func testWebhookStoreSaveIncoming(t *testing.T, ss store.Store) {
|
||||
}
|
||||
|
||||
func testWebhookStoreUpdateIncoming(t *testing.T, ss store.Store) {
|
||||
|
||||
var err error
|
||||
|
||||
o1 := buildIncomingWebhook()
|
||||
|
||||
Ссылка в новой задаче
Block a user