Skip to content

Commit

Permalink
Set assets to pending during unembargo
Browse files Browse the repository at this point in the history
  • Loading branch information
jjnesbitt committed Dec 18, 2024
1 parent 8ceb727 commit 2bb83e4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dandiapi/api/services/embargo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from dandiapi.api.mail import send_dandiset_unembargoed_message
from dandiapi.api.models import AssetBlob, Dandiset, Version
from dandiapi.api.models.asset import Asset
from dandiapi.api.services import audit
from dandiapi.api.services.asset.exceptions import DandisetOwnerRequiredError
from dandiapi.api.services.embargo.utils import _delete_object_tags, remove_dandiset_embargo_tags
Expand Down Expand Up @@ -47,13 +48,18 @@ def unembargo_dandiset(ds: Dandiset, user: User):
logger.info('Removing tags...')
remove_dandiset_embargo_tags(ds)

# Set all assets to pending
updated_assets = Asset.objects.filter(embargoed=True, versions__dandiset=ds).update(
status=Asset.Status.PENDING
)
# Update embargoed flag on asset blobs and zarrs
updated_blobs = AssetBlob.objects.filter(embargoed=True, assets__versions__dandiset=ds).update(
embargoed=False
)
updated_zarrs = ZarrArchive.objects.filter(
embargoed=True, assets__versions__dandiset=ds
).update(embargoed=False)
logger.info('Set %s assets to PENDING', updated_assets)
logger.info('Updated %s asset blobs', updated_blobs)
logger.info('Updated %s zarrs', updated_zarrs)

Expand Down

0 comments on commit 2bb83e4

Please sign in to comment.