forked from github/plane
fix: importer delete when imported_data is None (#1328)
This commit is contained in:
parent
0c3635cf25
commit
c9ebc20a8e
@ -239,17 +239,19 @@ class ImportServiceEndpoint(BaseAPIView):
|
|||||||
importer = Importer.objects.get(
|
importer = Importer.objects.get(
|
||||||
pk=pk, service=service, workspace__slug=slug
|
pk=pk, service=service, workspace__slug=slug
|
||||||
)
|
)
|
||||||
# Delete all imported Issues
|
|
||||||
imported_issues = importer.imported_data.get("issues", [])
|
|
||||||
Issue.issue_objects.filter(id__in=imported_issues).delete()
|
|
||||||
|
|
||||||
# Delete all imported Labels
|
if importer.imported_data is not None:
|
||||||
imported_labels = importer.imported_data.get("labels", [])
|
# Delete all imported Issues
|
||||||
Label.objects.filter(id__in=imported_labels).delete()
|
imported_issues = importer.imported_data.get("issues", [])
|
||||||
|
Issue.issue_objects.filter(id__in=imported_issues).delete()
|
||||||
|
|
||||||
if importer.service == "jira":
|
# Delete all imported Labels
|
||||||
imported_modules = importer.imported_data.get("modules", [])
|
imported_labels = importer.imported_data.get("labels", [])
|
||||||
Module.objects.filter(id__in=imported_modules).delete()
|
Label.objects.filter(id__in=imported_labels).delete()
|
||||||
|
|
||||||
|
if importer.service == "jira":
|
||||||
|
imported_modules = importer.imported_data.get("modules", [])
|
||||||
|
Module.objects.filter(id__in=imported_modules).delete()
|
||||||
importer.delete()
|
importer.delete()
|
||||||
return Response(status=status.HTTP_204_NO_CONTENT)
|
return Response(status=status.HTTP_204_NO_CONTENT)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user