Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Summary

Adds the ability to configure custom (granular) deletion policies for posts for specific teams and/or channels. When the daily retention job runs it selectively deletes posts by age based on the configuration.

...

Updates to the global retention policy continues to be managed via the config APIs.TBD: Does setting EnableMessageDeletion or EnableFileDeletion to false disable all of the policies?

...

Retention Policies

POST /api/v4/retention_policies create a new retention policy.

...

DELETE /api/v4/retention_policies/:policy_id deletes a retention policy.

As a prerequisite one must delete Deleting a RetentionPolicies record also deletes all of the associated RetentionPoliciesChannels and RetentionPoliciesTeams first, otherwise the request is rejected records.

...

GET /api/v4/retention_policies lists all retention policies, including associated teams and channels.

...

Request:

Code Block
{
    "team_idids": ["z7rxbxbfb7yxdydxzi8pestath"]
}

Response:

Code Block
{
    "success_ids": ["z7rxbxbfb7yxdydxzi8pestath"],
    "failure_ids": []
}

Because a teams can only be associated to a single granular retention policy, we must specify which teams failed.

...

DELETE /api/v4/retention_policies/:policy_id/teams/:team_id removes a team from a retention policy.

...

Request:

Code Block
{
    "channel_idids": ["z7rxbxbfb7yxdydxzi8pestath"]
}

Response:

Code Block
{
    "success_ids": ["z7rxbxbfb7yxdydxzi8pestath"],
    "failure_ids": []
}

Because a channel can only be associated to a single granular retention policy, we must specify which channels failed.

...

DELETE /api/v4/retention_policies/:policy_id/channels/:channel_id deletes a channel from a retention policy.

...

Column name

Description

PolicyId

varchar, the RetentionPolicies.Id foreign key

ChannelId

varchar, the Channels.Id foreign key

TBD: Does ChannelId need to be indexed?

RetentionPoliciesTeams table

Column name

Description

PolicyId

varchar, the RetentionPolicies.Id foreign key

TeamId

varchar, the Teams.Id foreign key

TBD: Does TeamId need to be indexed?

Model

  • Rename DataRetentionPolicy to GlobalDataRetentionPolicy

  • Add RetentionPolicy representing a record in the RetentionPolicies table.

  • Add RetentionPolicyChannel representing a record in the RetentionPoliciesChannels table.

  • Add RetentionPolicyTeam representing a record in the RetentionPoliciesTeams table.

Enterprise

Changes to various methods on DataRetentionWorker in data_retention/worker.go are required.

We need a new query to determine the Posts records to be deleted, the output of which can be a list of post ids to be used to delete Posts records and the following:

  • Reactions

  • Preferences (of Category ‘flagged_post’)

  • Threads

  • ThreadMemberships

  • LinkMetadata TBD: these aren’t currently purged via data retention, but they probably should be.

FileInfo (and their associated files on disk) and ChannelMemberHistory continue to be deleted system-wide with no new granularity.

TBD: Why is ChannelMemberHistory currently deleted as part of message retention days settings?

Mobile

No changes. Existing file-deleted and post-deleted UX covers all.