* Disambiguates some units.

* Updates DB attribute.

* Updates some more error-prone units.

* Updates some tests with legible constants.

* Updates query for MySQL case sensitivity.

* Fixes more casing issues.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
mkraft
2022-04-07 13:58:40 -04:00
коммит произвёл GitHub
родитель 15a9a7ad2f
Коммит ce2646de3e
15 изменённых файлов: 99 добавлений и 94 удалений

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

@@ -1170,7 +1170,7 @@ func TestGetAllChannels(t *testing.T) {
policy, err := th.App.Srv().Store.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "Policy 1",
PostDuration: model.NewInt64(30),
PostDurationDays: model.NewInt64(30),
},
ChannelIDs: []string{policyChannel.Id},
})
@@ -1622,7 +1622,7 @@ func TestSearchAllChannels(t *testing.T) {
policy, savePolicyErr := th.App.Srv().Store.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "Policy 1",
PostDuration: model.NewInt64(30),
PostDurationDays: model.NewInt64(30),
},
ChannelIDs: []string{policyChannel.Id},
})

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

@@ -1501,7 +1501,7 @@ func getTeamIcon(c *Context, w http.ResponseWriter, r *http.Request) {
}
w.Header().Set("Content-Type", "image/png")
w.Header().Set("Cache-Control", fmt.Sprintf("max-age=%v, private", 24*60*60)) // 24 hrs
w.Header().Set("Cache-Control", fmt.Sprintf("max-age=%v, private", model.DayInSeconds)) // 24 hrs
w.Header().Set(model.HeaderEtagServer, etag)
w.Write(img)
}

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

@@ -1067,7 +1067,7 @@ func TestGetAllTeams(t *testing.T) {
policy, savePolicyErr := th.App.Srv().Store.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "Policy 1",
PostDuration: model.NewInt64(30),
PostDurationDays: model.NewInt64(30),
},
TeamIDs: []string{policyTeam.Id},
})
@@ -1380,7 +1380,7 @@ func TestSearchAllTeams(t *testing.T) {
policy, savePolicyErr := th.App.Srv().Store.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "Policy 1",
PostDuration: model.NewInt64(30),
PostDurationDays: model.NewInt64(30),
},
TeamIDs: []string{policyTeam.Id},
})

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

@@ -364,7 +364,7 @@ func getDefaultProfileImage(c *Context, w http.ResponseWriter, r *http.Request)
return
}
w.Header().Set("Cache-Control", fmt.Sprintf("max-age=%v, private", 24*60*60)) // 24 hrs
w.Header().Set("Cache-Control", fmt.Sprintf("max-age=%v, private", model.DayInSeconds)) // 24 hrs
w.Header().Set("Content-Type", "image/png")
w.Write(img)
}
@@ -406,7 +406,7 @@ func getProfileImage(c *Context, w http.ResponseWriter, r *http.Request) {
if readFailed {
w.Header().Set("Cache-Control", fmt.Sprintf("max-age=%v, private", 5*60)) // 5 mins
} else {
w.Header().Set("Cache-Control", fmt.Sprintf("max-age=%v, private", 24*60*60)) // 24 hrs
w.Header().Set("Cache-Control", fmt.Sprintf("max-age=%v, private", model.DayInSeconds)) // 24 hrs
w.Header().Set(model.HeaderEtagServer, etag)
}

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

@@ -267,7 +267,7 @@ func (a *App) ExtendSessionExpiryIfNeeded(session *model.Session) bool {
// Only extend the expiry if the lessor of 1% or 1 day has elapsed within the
// current session duration.
threshold := int64(math.Min(float64(sessionLength)*0.01, float64(24*60*60*1000)))
threshold := int64(math.Min(float64(sessionLength)*0.01, float64(model.DayInMilliseconds)))
// Minimum session length is 1 day as of this writing, therefore a minimum ~14 minutes threshold.
// However we'll add a sanity check here in case that changes. Minimum 5 minute threshold,
// meaning we won't write a new expiry more than every 5 minutes.

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

@@ -284,6 +284,7 @@ type ServiceSettings struct {
TLSKeyFile *string `access:"environment_web_server,write_restrictable,cloud_restrictable"`
TLSMinVer *string `access:"write_restrictable,cloud_restrictable"` // telemetry: none
TLSStrictTransport *bool `access:"write_restrictable,cloud_restrictable"`
// In seconds.
TLSStrictTransportMaxAge *int64 `access:"write_restrictable,cloud_restrictable"` // telemetry: none
TLSOverwriteCiphers []string `access:"write_restrictable,cloud_restrictable"` // telemetry: none
UseLetsEncrypt *bool `access:"environment_web_server,write_restrictable,cloud_restrictable"`
@@ -1895,6 +1896,7 @@ type TeamSettings struct {
CustomBrandText *string `access:"site_customization"`
CustomDescriptionText *string `access:"site_customization"`
RestrictDirectMessage *string `access:"site_users_and_teams"`
// In seconds.
UserStatusAwayTimeout *int64 `access:"experimental_features"`
MaxChannelsPerTeam *int64 `access:"site_users_and_teams"`
MaxNotificationsPerChannel *int64 `access:"environment_push_notification_server"`

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

@@ -15,7 +15,7 @@ type GlobalRetentionPolicy struct {
type RetentionPolicy struct {
ID string `db:"Id" json:"id"`
DisplayName string `json:"display_name"`
PostDuration *int64 `json:"post_duration"`
PostDurationDays *int64 `db:"PostDuration" json:"post_duration"`
}
type RetentionPolicyWithTeamAndChannelIDs struct {
@@ -47,7 +47,7 @@ type RetentionPolicyWithTeamAndChannelCountsList struct {
type RetentionPolicyForTeam struct {
TeamID string `db:"Id" json:"team_id"`
PostDuration int64 `json:"post_duration"`
PostDurationDays int64 `db:"PostDuration" json:"post_duration"`
}
type RetentionPolicyForTeamList struct {
@@ -57,7 +57,7 @@ type RetentionPolicyForTeamList struct {
type RetentionPolicyForChannel struct {
ChannelID string `db:"Id" json:"channel_id"`
PostDuration int64 `json:"post_duration"`
PostDurationDays int64 `db:"PostDuration" json:"post_duration"`
}
type RetentionPolicyForChannelList struct {

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

@@ -11,9 +11,12 @@ import (
)
const (
DayInSeconds = 24 * 60 * 60
DayInMilliseconds = DayInSeconds * 1000
ExpiredLicenseError = "api.license.add_license.expired.app_error"
InvalidLicenseError = "api.license.add_license.invalid.app_error"
LicenseGracePeriod = 1000 * 60 * 60 * 24 * 10 //10 days
LicenseGracePeriod = DayInMilliseconds * 10 //10 days
LicenseRenewalLink = "https://mattermost.com/renew/"
LicenseShortSkuE10 = "E10"
@@ -307,7 +310,7 @@ func (l *License) HasEnterpriseMarketplacePlugins() bool {
// NewTestLicense returns a license that expires in the future and has the given features.
func NewTestLicense(features ...string) *License {
ret := &License{
ExpiresAt: GetMillis() + 90*24*60*60*1000,
ExpiresAt: GetMillis() + 90*DayInMilliseconds,
Customer: &Customer{},
Features: &Features{},
}

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

@@ -57,7 +57,7 @@ func (s *SqlRetentionPolicyStore) Save(policy *model.RetentionPolicyWithTeamAndC
policyInsertQuery, policyInsertArgs, err := s.getQueryBuilder().
Insert("RetentionPolicies").
Columns("Id", "DisplayName", "PostDuration").
Values(policy.ID, policy.DisplayName, policy.PostDuration).
Values(policy.ID, policy.DisplayName, policy.PostDurationDays).
ToSql()
if err != nil {
return nil, err
@@ -214,13 +214,13 @@ func (s *SqlRetentionPolicyStore) Patch(patch *model.RetentionPolicyWithTeamAndC
policyUpdateQuery := ""
policyUpdateArgs := []interface{}{}
if patch.DisplayName != "" || patch.PostDuration != nil {
if patch.DisplayName != "" || patch.PostDurationDays != nil {
builder := s.getQueryBuilder().Update("RetentionPolicies")
if patch.DisplayName != "" {
builder = builder.Set("DisplayName", patch.DisplayName)
}
if patch.PostDuration != nil {
builder = builder.Set("PostDuration", *patch.PostDuration)
if patch.PostDurationDays != nil {
builder = builder.Set("PostDuration", *patch.PostDurationDays)
}
policyUpdateQuery, policyUpdateArgs, err = builder.
Where(sq.Eq{"Id": patch.ID}).
@@ -357,7 +357,7 @@ func (s *SqlRetentionPolicyStore) buildGetPoliciesQuery(id string, offset, limit
Select(`
RetentionPolicies.Id as "Id",
RetentionPolicies.DisplayName,
RetentionPolicies.PostDuration,
RetentionPolicies.PostDuration as "PostDuration",
A.Count AS ChannelCount,
B.Count AS TeamCount
`).
@@ -697,7 +697,7 @@ func (s *SqlRetentionPolicyStore) DeleteOrphanedRows(limit int) (deleted int64,
func (s *SqlRetentionPolicyStore) GetTeamPoliciesForUser(userID string, offset, limit int) ([]*model.RetentionPolicyForTeam, error) {
query := s.getQueryBuilder().
Select(`Teams.Id AS "Id", RetentionPolicies.PostDuration`).
Select(`Teams.Id AS "Id", RetentionPolicies.PostDuration AS "PostDuration"`).
From("Users").
InnerJoin("TeamMembers ON Users.Id = TeamMembers.UserId").
InnerJoin("Teams ON TeamMembers.TeamId = Teams.Id").
@@ -758,7 +758,7 @@ func (s *SqlRetentionPolicyStore) GetTeamPoliciesCountForUser(userID string) (in
func (s *SqlRetentionPolicyStore) GetChannelPoliciesForUser(userID string, offset, limit int) ([]*model.RetentionPolicyForChannel, error) {
query := s.getQueryBuilder().
Select(`Channels.Id as "Id", RetentionPolicies.PostDuration`).
Select(`Channels.Id as "Id", RetentionPolicies.PostDuration as "PostDuration"`).
From("Users").
InnerJoin("ChannelMembers ON Users.Id = ChannelMembers.UserId").
InnerJoin("Channels ON ChannelMembers.ChannelId = Channels.Id").

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

@@ -376,13 +376,13 @@ func testPermanentDeleteBatchForRetentionPolicies(t *testing.T, ss store.Store)
channelPolicy, err := ss.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "DisplayName",
PostDuration: model.NewInt64(30),
PostDurationDays: model.NewInt64(30),
},
ChannelIDs: []string{channel.Id},
})
require.NoError(t, err)
nowMillis := leaveTime + *channelPolicy.PostDuration*24*60*60*1000 + 1
nowMillis := leaveTime + *channelPolicy.PostDurationDays*model.DayInMilliseconds + 1
_, _, err = ss.ChannelMemberHistory().PermanentDeleteBatchForRetentionPolicies(
nowMillis, 0, limit, model.RetentionPolicyCursor{})
require.NoError(t, err)

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

@@ -3806,7 +3806,7 @@ func testChannelStoreGetAllChannels(t *testing.T, ss store.Store, s SqlStore) {
policy, nErr := ss.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "Policy 1",
PostDuration: model.NewInt64(30),
PostDurationDays: model.NewInt64(30),
},
ChannelIDs: []string{c1.Id},
})
@@ -6270,7 +6270,7 @@ func testChannelStoreSearchAllChannels(t *testing.T, ss store.Store) {
_, nErr = ss.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "Policy 1",
PostDuration: model.NewInt64(30),
PostDurationDays: model.NewInt64(30),
},
ChannelIDs: []string{o14.Id},
})

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

@@ -3064,7 +3064,7 @@ func testPostStorePermanentDeleteBatch(t *testing.T, ss store.Store) {
channelPolicy, err2 := ss.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "DisplayName",
PostDuration: model.NewInt64(30),
PostDurationDays: model.NewInt64(30),
},
ChannelIDs: []string{channel.Id},
})
@@ -3083,7 +3083,7 @@ func testPostStorePermanentDeleteBatch(t *testing.T, ss store.Store) {
_, err2 = ss.Post().Get(context.Background(), post.Id, model.GetPostsOptions{}, "")
require.NoError(t, err2, "global policy should have been ignored due to granular policy")
nowMillis := post.CreateAt + *channelPolicy.PostDuration*24*60*60*1000 + 1
nowMillis := post.CreateAt + *channelPolicy.PostDurationDays*model.DayInMilliseconds + 1
_, _, err2 = ss.Post().PermanentDeleteBatchForRetentionPolicies(nowMillis, 0, 1000, model.RetentionPolicyCursor{})
require.NoError(t, err2)
_, err2 = ss.Post().Get(context.Background(), post.Id, model.GetPostsOptions{}, "")
@@ -3093,7 +3093,7 @@ func testPostStorePermanentDeleteBatch(t *testing.T, ss store.Store) {
teamPolicy, err2 := ss.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "DisplayName",
PostDuration: model.NewInt64(20),
PostDurationDays: model.NewInt64(20),
},
TeamIDs: []string{team.Id},
})
@@ -3102,7 +3102,7 @@ func testPostStorePermanentDeleteBatch(t *testing.T, ss store.Store) {
post, err2 = ss.Post().Save(post)
require.NoError(t, err2)
nowMillis = post.CreateAt + *teamPolicy.PostDuration*24*60*60*1000 + 1
nowMillis = post.CreateAt + *teamPolicy.PostDurationDays*model.DayInMilliseconds + 1
_, _, err2 = ss.Post().PermanentDeleteBatchForRetentionPolicies(nowMillis, 0, 1000, model.RetentionPolicyCursor{})
require.NoError(t, err2)
_, err2 = ss.Post().Get(context.Background(), post.Id, model.GetPostsOptions{}, "")
@@ -3145,7 +3145,7 @@ func testPostStorePermanentDeleteBatch(t *testing.T, ss store.Store) {
channelPolicy, err2 := ss.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "DisplayName",
PostDuration: model.NewInt64(30),
PostDurationDays: model.NewInt64(30),
},
ChannelIDs: []string{c1.Id},
})
@@ -3154,7 +3154,7 @@ func testPostStorePermanentDeleteBatch(t *testing.T, ss store.Store) {
teamPolicy, err2 := ss.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "DisplayName",
PostDuration: model.NewInt64(30),
PostDurationDays: model.NewInt64(30),
},
TeamIDs: []string{team.Id},
})
@@ -3186,7 +3186,7 @@ func testPostStorePermanentDeleteBatch(t *testing.T, ss store.Store) {
})
require.NoError(t, err2)
nowMillis := int64(1 + 30*24*60*60*1000 + 1)
nowMillis := int64(1 + 30*model.DayInMilliseconds + 1)
deleted, _, err2 := ss.Post().PermanentDeleteBatchForRetentionPolicies(nowMillis, 2, 1000, model.RetentionPolicyCursor{})
require.NoError(t, err2)
require.Equal(t, int64(3), deleted)

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

@@ -36,7 +36,7 @@ func getRetentionPolicyWithTeamAndChannelIds(t *testing.T, ss store.Store, polic
RetentionPolicy: model.RetentionPolicy{
ID: policyID,
DisplayName: policyWithCounts.DisplayName,
PostDuration: policyWithCounts.PostDuration,
PostDurationDays: policyWithCounts.PostDurationDays,
},
ChannelIDs: make([]string, int(policyWithCounts.ChannelCount)),
TeamIDs: make([]string, int(policyWithCounts.TeamCount)),
@@ -57,7 +57,7 @@ func getRetentionPolicyWithTeamAndChannelIds(t *testing.T, ss store.Store, polic
func CheckRetentionPolicyWithTeamAndChannelIdsAreEqual(t *testing.T, p1, p2 *model.RetentionPolicyWithTeamAndChannelIDs) {
require.Equal(t, p1.ID, p2.ID)
require.Equal(t, p1.DisplayName, p2.DisplayName)
require.Equal(t, p1.PostDuration, p2.PostDuration)
require.Equal(t, p1.PostDurationDays, p2.PostDurationDays)
require.Equal(t, len(p1.ChannelIDs), len(p2.ChannelIDs))
if p1.ChannelIDs == nil || p2.ChannelIDs == nil {
require.Equal(t, p1.ChannelIDs, p2.ChannelIDs)
@@ -83,7 +83,7 @@ func CheckRetentionPolicyWithTeamAndChannelIdsAreEqual(t *testing.T, p1, p2 *mod
func CheckRetentionPolicyWithTeamAndChannelCountsAreEqual(t *testing.T, p1, p2 *model.RetentionPolicyWithTeamAndChannelCounts) {
require.Equal(t, p1.ID, p2.ID)
require.Equal(t, p1.DisplayName, p2.DisplayName)
require.Equal(t, p1.PostDuration, p2.PostDuration)
require.Equal(t, p1.PostDurationDays, p2.PostDurationDays)
require.Equal(t, p1.ChannelCount, p2.ChannelCount)
require.Equal(t, p1.TeamCount, p2.TeamCount)
}
@@ -176,7 +176,7 @@ func createRetentionPolicyWithTeamAndChannelIds(displayName string, teamIDs, cha
return &model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: displayName,
PostDuration: model.NewInt64(30),
PostDurationDays: model.NewInt64(30),
},
TeamIDs: teamIDs,
ChannelIDs: channelIDs,
@@ -256,21 +256,21 @@ func testRetentionPolicyStorePatch(t *testing.T, ss store.Store, s SqlStore) {
patch := &model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
ID: policy.ID,
PostDuration: model.NewInt64(10000),
PostDurationDays: model.NewInt64(10000),
},
}
_, err := ss.RetentionPolicy().Patch(patch)
require.NoError(t, err)
expected := copyRetentionPolicyWithTeamAndChannelIds(policy)
expected.PostDuration = patch.PostDuration
expected.PostDurationDays = patch.PostDurationDays
checkRetentionPolicyLikeThisExists(t, ss, expected)
// Store a negative value (= infinity)
patch.PostDuration = model.NewInt64(-1)
patch.PostDurationDays = model.NewInt64(-1)
_, err = ss.RetentionPolicy().Patch(patch)
require.NoError(t, err)
expected = copyRetentionPolicyWithTeamAndChannelIds(policy)
expected.PostDuration = patch.PostDuration
expected.PostDurationDays = patch.PostDurationDays
checkRetentionPolicyLikeThisExists(t, ss, expected)
restoreRetentionPolicy(t, ss, policy)

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

@@ -260,7 +260,7 @@ func testTeamStoreSearchAll(t *testing.T, ss store.Store) {
_, err = ss.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "Policy 1",
PostDuration: model.NewInt64(20),
PostDurationDays: model.NewInt64(20),
},
TeamIDs: []string{q.Id},
})
@@ -666,7 +666,7 @@ func testTeamStoreGetAllPage(t *testing.T, ss store.Store) {
policy, err := ss.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "Policy 1",
PostDuration: model.NewInt64(30),
PostDurationDays: model.NewInt64(30),
},
TeamIDs: []string{o.Id},
})

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

@@ -443,13 +443,13 @@ func testThreadStorePermanentDeleteBatchForRetentionPolicies(t *testing.T, ss st
channelPolicy, err := ss.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "DisplayName",
PostDuration: model.NewInt64(30),
PostDurationDays: model.NewInt64(30),
},
ChannelIDs: []string{channel.Id},
})
require.NoError(t, err)
nowMillis := thread.LastReplyAt + *channelPolicy.PostDuration*24*60*60*1000 + 1
nowMillis := thread.LastReplyAt + *channelPolicy.PostDurationDays*model.DayInMilliseconds + 1
_, _, err = ss.Thread().PermanentDeleteBatchForRetentionPolicies(nowMillis, 0, limit, model.RetentionPolicyCursor{})
require.NoError(t, err)
thread, err = ss.Thread().Get(post.Id)
@@ -465,13 +465,13 @@ func testThreadStorePermanentDeleteBatchForRetentionPolicies(t *testing.T, ss st
teamPolicy, err := ss.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "DisplayName",
PostDuration: model.NewInt64(20),
PostDurationDays: model.NewInt64(20),
},
TeamIDs: []string{team.Id},
})
require.NoError(t, err)
nowMillis = thread.LastReplyAt + *teamPolicy.PostDuration*24*60*60*1000 + 1
nowMillis = thread.LastReplyAt + *teamPolicy.PostDurationDays*model.DayInMilliseconds + 1
_, _, err = ss.Thread().PermanentDeleteBatchForRetentionPolicies(nowMillis, 0, limit, model.RetentionPolicyCursor{})
require.NoError(t, err)
_, err = ss.Thread().Get(post.Id)
@@ -530,13 +530,13 @@ func testThreadStorePermanentDeleteBatchThreadMembershipsForRetentionPolicies(t
channelPolicy, err := ss.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "DisplayName",
PostDuration: model.NewInt64(30),
PostDurationDays: model.NewInt64(30),
},
ChannelIDs: []string{channel.Id},
})
require.NoError(t, err)
nowMillis := threadMembership.LastUpdated + *channelPolicy.PostDuration*24*60*60*1000 + 1
nowMillis := threadMembership.LastUpdated + *channelPolicy.PostDurationDays*model.DayInMilliseconds + 1
_, _, err = ss.Thread().PermanentDeleteBatchThreadMembershipsForRetentionPolicies(nowMillis, 0, limit, model.RetentionPolicyCursor{})
require.NoError(t, err)
_, err = ss.Thread().GetMembershipForUser(userID, post.Id)
@@ -549,13 +549,13 @@ func testThreadStorePermanentDeleteBatchThreadMembershipsForRetentionPolicies(t
teamPolicy, err := ss.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
RetentionPolicy: model.RetentionPolicy{
DisplayName: "DisplayName",
PostDuration: model.NewInt64(20),
PostDurationDays: model.NewInt64(20),
},
TeamIDs: []string{team.Id},
})
require.NoError(t, err)
nowMillis = threadMembership.LastUpdated + *teamPolicy.PostDuration*24*60*60*1000 + 1
nowMillis = threadMembership.LastUpdated + *teamPolicy.PostDurationDays*model.DayInMilliseconds + 1
_, _, err = ss.Thread().PermanentDeleteBatchThreadMembershipsForRetentionPolicies(nowMillis, 0, limit, model.RetentionPolicyCursor{})
require.NoError(t, err)
_, err = ss.Thread().GetMembershipForUser(userID, post.Id)