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.

...

The feature requires some new APIs, some new tables, and an edit to the existing data retention job logic.

API

Global Policy (existing API)

GET /api/v4/data_retention/policy retrieves the global retention settings.

...

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.

...

Code Block
{
    "policies": [
        {
            "display_name": "foo",
            "post_duration": 2,
            "teams": [
                {
                    "id": "z7rxbxbfb7yxdydxzi8pestath",
                    "display_name": "My Team 1"
                }
            ],
            "channels": [
                {
                    "id": "z7rxbxbfb7yxdydxzi8pestath",
                    "display_name": "Off Topic",
                    "team_display_name": "My Team 1"
                }
            ]
        }
    ],
    "total_count": 1
}

...

Retention Policies Teams

POST /api/v4/retention_policies/:policy_id/teams associates a team to a retention policy.

...

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

...

Retention Policies Channels

POST /api/v4/retention_policies/:policy_id/channels associates a channel to a retention policy.

...

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

...

Database

RetentionPolicies table

Column name

Description

Id

varchar, primary key

DisplayName

varchar

PostDuration

int, the duration in days to keep posts

...

Column name

Description

PolicyId

varchar, the RetentionPolicies.Id foreign key

TeamId

varchar, the Teams.Id foreign key

Model

  • Rename DataRetentionPolicy to GlobalDataRetentionPolicy

  • Add RetentionPolicy

  • Add RetentionPolicyChannel

  • Add RetentionPolicyTeam

Enterprise

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

Mobile

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