Skip to content

Commit

Permalink
fix(core): Set user whom added comment as comment user
Browse files Browse the repository at this point in the history
ref: #460 #467
  • Loading branch information
jon-nfc committed Jan 9, 2025
1 parent a6fda85 commit ba2d809
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions app/core/serializers/ticket_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,6 @@ def __init__(self, instance=None, data=empty, **kwargs):

self.request = kwargs['context']['request']

if 'view' in kwargs['context']:

if kwargs['context']['view'].action == 'create':


if 'request' in kwargs['context']['view'].kwargs:

self.fields.fields['user'].initial = self.request._user.id



def validate(self, attrs):
Expand Down Expand Up @@ -251,6 +242,8 @@ def is_valid(self, *, raise_exception=False):

if self._context['view'].action == 'create':

self.validated_data['user'] = self.request._user

if 'ticket_id' in self._kwargs['context']['view'].kwargs:

self.validated_data['ticket_id'] = int(self._kwargs['context']['view'].kwargs['ticket_id'])
Expand Down

0 comments on commit ba2d809

Please sign in to comment.