Merge pull request #5607 from FinnStutzenstein/fixTbs

Attempt to fix some tracebacks
This commit is contained in:
Finn Stutzenstein 2020-10-08 10:52:06 +02:00 committed by GitHub
commit b9f78f501d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 0 deletions

View File

@ -432,6 +432,7 @@ class SpeakerManager(models.Manager):
"""
if isinstance(user, AnonymousUser):
raise OpenSlidesError("An anonymous user can not be on lists of speakers.")
if self.filter(
user=user, list_of_speakers=list_of_speakers, begin_time=None
).exists():

View File

@ -847,6 +847,10 @@ class WhoAmIDataView(APIView):
user_full_data = async_to_sync(element_cache.get_element_data)(
self.request.user.get_collection_string(), user_id
)
if user_full_data is None:
return Response(
{"detail": "Cache offline, could not fetch user"}, status=500
)
auth_type = user_full_data["auth_type"]
user_data = async_to_sync(element_cache.restrict_element_data)(
user_full_data, self.request.user.get_collection_string(), user_id

View File

@ -8,6 +8,7 @@ from channels.layers import get_channel_layer
from django.db.models import Model
from mypy_extensions import TypedDict
from .auth import UserDoesNotExist
from .cache import ChangeIdTooLowError, element_cache, get_element_id
from .projector import get_projector_data
from .timing import Timing
@ -303,6 +304,15 @@ class AutoupdateBundleMiddleware:
async def get_autoupdate_data(
from_change_id: int, user_id: int
) -> Tuple[int, Optional[AutoupdateFormat]]:
try:
return await _get_autoupdate_data(from_change_id, user_id)
except UserDoesNotExist:
return 0, None
async def _get_autoupdate_data(
from_change_id: int, user_id: int
) -> Tuple[int, Optional[AutoupdateFormat]]:
"""
Returns the max_change_id and the autoupdate from from_change_id to max_change_id