Skip to content

Commit

Permalink
Merge pull request #1870 from anehx/remove-wrong-event
Browse files Browse the repository at this point in the history
fix(events): don't emit create work item events when updating
  • Loading branch information
anehx authored Sep 9, 2022
2 parents b94b8ab + 4f2f491 commit e463de2
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 e463de2

Please sign in to comment.