[MM-64360] Data retention: optionally preserve pinned posts (#31165)
* add new config to preserve pinned posts during data retention * more graceful error if the pinned post was a reply in a deleted thread
Этот коммит содержится в:
@@ -3119,6 +3119,7 @@ type DataRetentionSettings struct {
|
||||
BatchSize *int `access:"compliance_data_retention_policy"`
|
||||
TimeBetweenBatchesMilliseconds *int `access:"compliance_data_retention_policy"`
|
||||
RetentionIdsBatchSize *int `access:"compliance_data_retention_policy"`
|
||||
PreservePinnedPosts *bool `access:"compliance_data_retention_policy"`
|
||||
}
|
||||
|
||||
func (s *DataRetentionSettings) SetDefaults() {
|
||||
@@ -3168,6 +3169,10 @@ func (s *DataRetentionSettings) SetDefaults() {
|
||||
if s.RetentionIdsBatchSize == nil {
|
||||
s.RetentionIdsBatchSize = NewPointer(DataRetentionSettingsDefaultRetentionIdsBatchSize)
|
||||
}
|
||||
|
||||
if s.PreservePinnedPosts == nil {
|
||||
s.PreservePinnedPosts = NewPointer(false)
|
||||
}
|
||||
}
|
||||
|
||||
// GetMessageRetentionHours returns the message retention time as an int.
|
||||
|
||||
@@ -91,6 +91,13 @@ type RetentionIdsForDeletion struct {
|
||||
Ids []string
|
||||
}
|
||||
|
||||
type RetentionPolicyBatchConfigs struct {
|
||||
Now int64
|
||||
GlobalPolicyEndTime int64
|
||||
Limit int64
|
||||
PreservePinnedPosts bool
|
||||
}
|
||||
|
||||
func (r *RetentionIdsForDeletion) PreSave() {
|
||||
if r.Id == "" {
|
||||
r.Id = NewId()
|
||||
|
||||
Ссылка в новой задаче
Block a user