Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(trashBin): ensure the project is fully restored from the admin interface TASK-1645 #5563

Merged
merged 2 commits into from
Mar 3, 2025

Conversation

noliveleger
Copy link
Contributor

@noliveleger noliveleger commented Feb 28, 2025

📣 Summary

Fixed an issue where projects were not being completely restored from the trash.

📖 Description

A bug prevented projects from being fully restored after being moved to the trash, leading to missing or incomplete data upon recovery.

💭 Notes

Some unittests were apparently missing for this part, this PR adds two new tests. Moreover, part of kpi#5514 has been backported to this release.

👀 Preview steps

Bug template:

  1. ℹ️ have a non-admin account and a project
  2. delete the project
  3. go the admin interface and put back the project from the trash bin
  4. from the shell run this snippet
asset = Asset.objects.get(uid='<asset_uid>')
xform = XForm.all_objects.get(kpi_asset_uid=asset.uid)
print(xform.pending_delete)
  1. 🔴 [on release branch] (from the shell) notice the output is True

This snippet should raise an exception

>>> asset.deployment.xform
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/srv/src/kpi/kpi/deployment_backends/openrosa_backend.py", line 1229, in xform
    raise MissingXFormException
kpi.exceptions.MissingXFormException
  1. 🟢 [on PR] (from the shell) notice the output is False

This snippet shouldn't raise an exception

>>> asset.deployment.xform
<XForm "id_string">

@noliveleger noliveleger requested a review from jnm as a code owner February 28, 2025 09:35
@noliveleger noliveleger self-assigned this Feb 28, 2025
@noliveleger noliveleger removed the request for review from jnm February 28, 2025 09:36
@noliveleger noliveleger changed the base branch from main to release/2.024.36 February 28, 2025 09:41
@noliveleger noliveleger changed the title fix(trashBin): Ensure the project is fully restored from the trash fix(trashBin): ensure the project is fully restored from the trash TASK-1645 Feb 28, 2025
@noliveleger noliveleger changed the title fix(trashBin): ensure the project is fully restored from the trash TASK-1645 fix(trashBin): ensure the project is fully restored from the admin interface TASK-1645 Feb 28, 2025
@noliveleger noliveleger requested a review from rgraber February 28, 2025 16:36
Copy link
Contributor

@rgraber rgraber left a comment

Choose a reason for hiding this comment

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

2 small things

@@ -126,16 +126,22 @@ def asset(self):
# uses an Asset object only to narrow down a query with a filter,
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is no longer accurate

@noliveleger noliveleger force-pushed the fix-trash-bin-put-back branch from 8d6740e to 9d594d6 Compare March 3, 2025 08:00
@noliveleger noliveleger merged commit 481fcd8 into release/2.024.36 Mar 3, 2025
6 checks passed
@noliveleger noliveleger deleted the fix-trash-bin-put-back branch March 3, 2025 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants