Skip to content

CATROID-1662 Let user revert project deletion#5227

Draft
hannesweilharter wants to merge 2 commits into
Catrobat:developfrom
hannesweilharter:CATROID-1662
Draft

CATROID-1662 Let user revert project deletion#5227
hannesweilharter wants to merge 2 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.java:

  • deleteProjectShowUndoButtonTest
  • undoDeletedProjectTest
  • undoOptionNotVisibleAfterActivityChangeTest

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

if (restored) {
ToastUtil.showSuccess(requireContext(), R.string.restored_project)
showUndo(false)
getLocalProjectListAsync(object: LoadProjectsListener {
@sonarqubecloud

Copy link
Copy Markdown

@harshsomankar123-tech harshsomankar123-tech added the Active Member Tickets that are assigned to members that are still currently active label Jul 11, 2026
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