Skip to content

Commit

Permalink
fix: LSDV-5307: Import review and drafts from exported snapshots: Add…
Browse files Browse the repository at this point in the history
… tests, little fixes (HumanSignal#4527)

fix: LSDV-5307: Import review and drafts from exported snapshots: Add tests and little fixes
  • Loading branch information
makseq authored Jul 18, 2023
1 parent 480715e commit 638083e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions label_studio/tasks/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,8 @@ def _insert_valid_user_reviews(dicts, members_email_to_id, default_user):
:return:
"""
for obj in dicts:
email = obj.get('created_by', {}).get('email')
if email is None:
raise ValidationError(f"Object must have created_by field and it should contain dict with email")
created_by = obj.get('created_by', {})
email = created_by.get('email') if isinstance(created_by, dict) else None

# user default user
if email not in members_email_to_id:
Expand All @@ -301,8 +300,6 @@ def _insert_valid_user_drafts(dicts, members_email_to_id, default_user):
"""
for obj in dicts:
email = obj.get('user')
if email is None:
raise ValidationError(f"Object must have user field and it should contain email")

# user default user
if email not in members_email_to_id:
Expand Down

0 comments on commit 638083e

Please sign in to comment.