Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit d0e166db authored by BAIRE Anthony's avatar BAIRE Anthony
Browse files

when overwriting a version, display the deleted ids (if any)

parent 6dba797b
Pipeline #139134 failed with stages
in 2 seconds
......@@ -718,16 +718,20 @@ class WebappVersionUpdate(UserAccessMixin, UpdateView):
if version.state in (WebappVersion.READY, WebappVersion.DELETED):
# delete the version that is currently READY
other_versions.filter(state=WebappVersion.READY
).update(state=WebappVersion.DELETED, deleted_at=django.utils.timezone.now())
deleted_versions = other_versions.filter(state=WebappVersion.READY)
deleted_ids = [v.id for v in deleted_versions]
deleted_versions.update(state=WebappVersion.DELETED, deleted_at=django.utils.timezone.now())
if version.state == WebappVersion.DELETED:
# mark the current version as READY
version.state = WebappVersion.READY
version.deleted_at = None
messages.success(self.request, "Version %s (#%d) restored"
% (version.number, version.id))
for i in deleted_ids:
messages.success(self.request, "Version %s (#%d) deleted" % (version.number, i))
messages.success(self.request, "Version %s (#%d) restored" % (
version.number, version.id))
else:
messages.success(self.request, "Version %s (#%d) updated"
% (version.number, version.id))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment