Skip to content

Restore the published field and content database when restoring a deleted channel #5628

@AlexVelezLl

Description

@AlexVelezLl

This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

When a channel is deleted and then restored, the channel published's state is not fully recovered

Current Behavior

  • When a channel is deleted:

    • The channel main_tree.published field is set to false
    • Main content database ({channel_id}.sqlite3) is removed
  • When a channel is restored:

    • The channel is restored just by setting its deleted field to false, but none of the publish stat is recovered (although the version field is still set).

This creates inconsistencies because after a channel is deleted and then restored, its version field is set, but its main_tree.published is false.

Technical details

When restoring a deleted channel channel.version > 0, we should:

  • Restore the main_tree.published field to true.
  • Restore the main content database in a background task:
    • Copy the latest versioned database {channel_id}_{version}.sqlite3 to become the main database {channel_id}.sqlite3. Similarly to what we do on the ensure_versioned_database_exists, but in the other direction.

Acceptance Criteria

  • When a deleted channel is restored, its main_tree.published field is automatically set to true
  • A background task is created to restore the main content database

🤖 This issue was written with AI assistance, under supervision, review, and final edits by @AlexVelezLl 🤖

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions