Skip to content

Commit

Permalink
fix(events): don't emit create work item events when updating
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The `saveWorkItem` mutation doesn't emit
`pre_create_work_item` `post_create_work_item` anymore since this is not
the expected behaviour.
  • Loading branch information
anehx committed Sep 9, 2022
1 parent ab13be7 commit 4f2f491
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions caluma/caluma_workflow/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ class Meta:
fields = ["id", "context"]


class SaveWorkItemSerializer(SendEventSerializerMixin, ContextModelSerializer):
class SaveWorkItemSerializer(ContextModelSerializer):
work_item = serializers.GlobalIDField(source="id")
name = CharField(
required=False,
Expand All @@ -467,17 +467,6 @@ class SaveWorkItemSerializer(SendEventSerializerMixin, ContextModelSerializer):
help_text=models.WorkItem._meta.get_field("description").help_text,
)

@transaction.atomic
def update(self, instance, validated_data):
self.send_event(
events.pre_create_work_item,
work_item=instance,
validated_data=validated_data,
)
instance = super().update(instance, validated_data)
self.send_event(events.post_create_work_item, work_item=instance)
return instance

class Meta:
model = models.WorkItem
fields = [
Expand Down

0 comments on commit 4f2f491

Please sign in to comment.