Skip to content

CATROID-1662 Let user revert project deletion - #5227

Open
hannesweilharter wants to merge 5 commits into
Catrobat:developfrom
hannesweilharter:CATROID-1662
Open

CATROID-1662 Let user revert project deletion#5227
hannesweilharter wants to merge 5 commits into
Catrobat:developfrom
hannesweilharter:CATROID-1662

Conversation

@hannesweilharter

@hannesweilharter hannesweilharter commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Currently, when a user accidentially deletes a project, there is no way to recover the deleted project.
This PR introduces an undo functionality for project deletions. They are tracked and can be reverted with an undo-button in the top menu bar, similar to the one that already exists for modifications inside a project or in the backpack. Initially only the last deleted project is tracked and can be reverted.

Implementation Details

  • Before a project is deleted, its entire directory is copied into a dedicated hidden backup location (PROJECT_DELETION_UNDO_DIRECTORY).
  • If the backup is created successfully, the original project is deleted as usual.
  • The UI displays an Undoaction whenever a valid backup exists.
  • Selecting Undo restores the project by copying the backup back into the projects directory.
  • If another project with the same name already exists, a unique project name is generated automatically, and the project's metadata (code.xml) is updated accordingly.
  • After a successful restore, the temporary backup is removed and the Undo option is hidden.

Testcases
added in DeleteProjectTest:

  • deleteProjectShowUndoButtonTest
  • undoDeletedProjectTest
  • undoOptionNotVisibleAfterActivityChangeTest

Additionally, the file DeleteProjectTest was refactored to Kotlin.

https://catrobat.atlassian.net/browse/CATROID-1662

Your checklist for this pull request

Please review the contributing guidelines and wiki pages of this repository.

  • Include the name of the Jira ticket in the PR’s title
  • Include a summary of the changes plus the relevant context
  • Choose the proper base branch (develop)
  • Confirm that the changes follow the project’s coding guidelines
  • Verify that the changes generate no compiler or linter warnings
  • Perform a self-review of the changes
  • Verify to commit no other files than the intentionally changed ones
  • Include reasonable and readable tests verifying the added or changed behavior
  • Confirm that new and existing unit tests pass locally
  • Check that the commits’ message style matches the project’s guideline
  • Stick to the project’s gitflow workflow
  • Verify that your changes do not have any conflicts with the base branch
  • After the PR, verify that all CI checks have passed
  • Post a message in the catroid-stage or catroid-ide Slack channel and ask for a code reviewer
screen_rec.webm

@harshsomankar123-tech harshsomankar123-tech added the Active Member Tickets that are assigned to members that are still currently active label Jul 11, 2026
@hannesweilharter
hannesweilharter marked this pull request as ready for review July 13, 2026 15:25

@harshsomankar123-tech harshsomankar123-tech left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hannesweilharter Thanks for the feature! It would be great if you could also add a screencast of the feature

@sonarqubecloud

Copy link
Copy Markdown

@harshsomankar123-tech

Copy link
Copy Markdown
Member

@hannesweilharter Thanks! but i think we are discuss different approach to solve this problem from snackbar.
cc @reichli @wslany

@sonarqubecloud

sonarqubecloud Bot commented Sep 4, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Active Member Tickets that are assigned to members that are still currently active

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants