Skip to content

Commit

Permalink
api: Fixed conversations at register
Browse files Browse the repository at this point in the history
  • Loading branch information
okbrandon committed Nov 14, 2024
1 parent f315601 commit 8ced8af
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions backend/api/views/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,6 @@ def post(self, request, *args, **kwargs):
status=1 # Accepted/friends status
)

# Create the conversation between the user and the AI
friend = User.objects.get(userID='user_ai')
existing_conversation = Conversation.objects.filter(
participants__userID__in=[user.userID, 'user_ai'],
conversationType='private_message'
).annotate(participant_count=Count('participants')).filter(participant_count=2).exists()

if not existing_conversation:
new_conversation = Conversation.objects.create(conversationID=generate_id("conv"), conversationType='private_message')
new_conversation.receipientID = user.userID
new_conversation.participants.add(user, friend)
new_conversation.save()

if not skip_email_verification:
verification_code = generate_id('code')
VerificationCode.objects.create(
Expand Down

0 comments on commit 8ced8af

Please sign in to comment.