learningequality / learningequality/studio

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

Open
#5,628 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
191
Forks
307
Avg merge
5d 6h
Merged PRs (30d)
10

Description

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 🤖

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

This issue is marked as not open for contribution. If work proceeds, inspect the channel deletion and restoration logic in contentcuration/models.py, then compare it with ensure_versioned_database_exists in contentcuration/utils/publish.py. Done means restoration sets main_tree.published to true and creates a background task that restores the main content database.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlite
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.