|
|
@ -12,6 +12,7 @@ from ..exceptions import HttpError, PermissionDenied
|
|
|
|
from ..msgpack import MsgpackRoute
|
|
|
|
from ..msgpack import MsgpackRoute
|
|
|
|
from ..utils import (
|
|
|
|
from ..utils import (
|
|
|
|
get_object_or_404,
|
|
|
|
get_object_or_404,
|
|
|
|
|
|
|
|
get_user_username_email_kwargs,
|
|
|
|
Context,
|
|
|
|
Context,
|
|
|
|
is_collection_admin,
|
|
|
|
is_collection_admin,
|
|
|
|
BaseModel,
|
|
|
|
BaseModel,
|
|
|
@ -191,9 +192,8 @@ def outgoing_create(
|
|
|
|
user: UserType = Depends(get_authenticated_user),
|
|
|
|
user: UserType = Depends(get_authenticated_user),
|
|
|
|
):
|
|
|
|
):
|
|
|
|
collection = get_object_or_404(models.Collection.objects, uid=data.collection)
|
|
|
|
collection = get_object_or_404(models.Collection.objects, uid=data.collection)
|
|
|
|
to_user = get_object_or_404(
|
|
|
|
kwargs = get_user_username_email_kwargs(data.username)
|
|
|
|
get_user_queryset(User.objects.all(), CallbackContext(request.path_params)), username=data.username
|
|
|
|
to_user = get_object_or_404(get_user_queryset(User.objects.all(), CallbackContext(request.path_params)), **kwargs)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context = Context(user, None)
|
|
|
|
context = Context(user, None)
|
|
|
|
data.validate_db(context)
|
|
|
|
data.validate_db(context)
|
|
|
@ -238,7 +238,7 @@ def outgoing_fetch_user_profile(
|
|
|
|
request: Request,
|
|
|
|
request: Request,
|
|
|
|
user: UserType = Depends(get_authenticated_user),
|
|
|
|
user: UserType = Depends(get_authenticated_user),
|
|
|
|
):
|
|
|
|
):
|
|
|
|
kwargs = {User.USERNAME_FIELD: username.lower()}
|
|
|
|
kwargs = get_user_username_email_kwargs(username)
|
|
|
|
user = get_object_or_404(get_user_queryset(User.objects.all(), CallbackContext(request.path_params)), **kwargs)
|
|
|
|
user = get_object_or_404(get_user_queryset(User.objects.all(), CallbackContext(request.path_params)), **kwargs)
|
|
|
|
user_info = get_object_or_404(models.UserInfo.objects.all(), owner=user)
|
|
|
|
user_info = get_object_or_404(models.UserInfo.objects.all(), owner=user)
|
|
|
|
return UserInfoOut.from_orm(user_info)
|
|
|
|
return UserInfoOut.from_orm(user_info)
|
|
|
|