diff --git a/src/api/invitations.py b/src/api/invitations.py index 86bbcd5..94110af 100644 --- a/src/api/invitations.py +++ b/src/api/invitations.py @@ -150,6 +150,7 @@ async def get_user_incomming_invitatinos(user_id: PydanticObjectId, user: Curren """Get all incoming invitations for a given user. Note that this endpoint only allows you to access the invitations you received. + Only invitations with status "pending" are returned. """ if user.id is None: raise MissingIdError(user) @@ -157,7 +158,11 @@ async def get_user_incomming_invitatinos(user_id: PydanticObjectId, user: Curren if user.id != user_id: raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="You can only access your own invitations.") - invitations = await Invitation.find(expr(Invitation.invitee).id == user_id, fetch_links=True).to_list() + invitations = await Invitation.find( + expr(Invitation.invitee).id == user_id, + Invitation.status == "pending", + fetch_links=True, + ).to_list() return [InvitationData.from_invitation(invitation) for invitation in invitations]