Actually add the user as attendee on accepted invite
This commit is contained in:
parent
fcf5a5d64d
commit
6c9afdbdeb
|
@ -228,10 +228,19 @@ async def accept_invitation(invitation_id: PydanticObjectId, user: CurrentUserDe
|
|||
detail="You can only accept pending invitations.",
|
||||
)
|
||||
|
||||
# Mark the invitation as accepted
|
||||
invitation.status = "accepted"
|
||||
invitation.responded_at = datetime.now(tz=UTC)
|
||||
_ = await invitation.save()
|
||||
|
||||
# Add the user to the event
|
||||
event = invitation.event
|
||||
if isinstance(event, Link):
|
||||
raise UnfetchedLinkError(event)
|
||||
|
||||
event.attendees.append(invitation.invitee)
|
||||
event = await event.replace()
|
||||
|
||||
# Send back a notification to the invitor about the acceptance
|
||||
notification = Notification(
|
||||
user=invitation.invitor,
|
||||
|
|
Loading…
Reference in a new issue