Fixed race condition on multiple attachment deletion
parent
340bc7670b
commit
0a900cc84d
|
@ -74,7 +74,7 @@ class BaseAttachmentViewSet(HistoryResourceMixin, WatchedResourceMixin,
|
||||||
# NOTE: When destroy an attachment, the content_object change
|
# NOTE: When destroy an attachment, the content_object change
|
||||||
# after and not before
|
# after and not before
|
||||||
self.persist_history_snapshot(obj, delete=True)
|
self.persist_history_snapshot(obj, delete=True)
|
||||||
super().pre_delete(obj)
|
super().post_delete(obj)
|
||||||
|
|
||||||
def get_object_for_snapshot(self, obj):
|
def get_object_for_snapshot(self, obj):
|
||||||
return obj.content_object
|
return obj.content_object
|
||||||
|
|
|
@ -62,7 +62,7 @@ class HistoryResourceMixin(object):
|
||||||
obj = self.get_object()
|
obj = self.get_object()
|
||||||
|
|
||||||
sobj = self.get_object_for_snapshot(obj)
|
sobj = self.get_object_for_snapshot(obj)
|
||||||
if sobj != obj and delete:
|
if sobj != obj:
|
||||||
delete = False
|
delete = False
|
||||||
|
|
||||||
notifications_services.analize_object_for_watchers(obj, comment, user)
|
notifications_services.analize_object_for_watchers(obj, comment, user)
|
||||||
|
|
Loading…
Reference in New Issue