[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
Этот коммит содержится в:
Ben Cooke
2025-06-09 15:41:07 -04:00
коммит произвёл GitHub
родитель 6eb2128abc
Коммит aac34f6db4
23 изменённых файлов: 388 добавлений и 106 удалений

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

@@ -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()