diff --git a/mypy.ini b/mypy.ini index 61406f0331..af039c135f 100644 --- a/mypy.ini +++ b/mypy.ini @@ -315,8 +315,6 @@ strict_optional = False strict_optional = False [mypy-zerver.views.messages] # Other issues in this file too strict_optional = False -[mypy-zerver.views.users] # Other issues in this file too -strict_optional = False # One change required? diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index 13cb86745a..d1af86015c 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -483,7 +483,7 @@ def do_create_user(email: str, password: Optional[str], realm: Realm, full_name: timezone: str="", avatar_source: str=UserProfile.AVATAR_FROM_GRAVATAR, default_sending_stream: Optional[Stream]=None, default_events_register_stream: Optional[Stream]=None, - default_all_public_streams: bool=None, + default_all_public_streams: Optional[bool]=None, prereg_user: Optional[PreregistrationUser]=None, newsletter_data: Optional[Dict[str, str]]=None, default_stream_groups: List[DefaultStreamGroup]=[], diff --git a/zerver/lib/users.py b/zerver/lib/users.py index 667bef5a41..a383d9d889 100644 --- a/zerver/lib/users.py +++ b/zerver/lib/users.py @@ -67,7 +67,7 @@ def check_valid_bot_type(user_profile: UserProfile, bot_type: int) -> None: if bot_type not in user_profile.allowed_bot_types: raise JsonableError(_('Invalid bot type')) -def check_valid_interface_type(interface_type: int) -> None: +def check_valid_interface_type(interface_type: Optional[int]) -> None: if interface_type not in Service.ALLOWED_INTERFACE_TYPES: raise JsonableError(_('Invalid interface type')) diff --git a/zerver/views/users.py b/zerver/views/users.py index 4574f57061..c2aa11919e 100644 --- a/zerver/views/users.py +++ b/zerver/views/users.py @@ -141,6 +141,7 @@ def avatar(request: HttpRequest, email_or_id: str, medium: bool=False) -> HttpRe # our templates depend on being able to use the ampersand to # add query parameters to our url, get_avatar_url does '?x=x' # hacks to prevent us from having to jump through decode/encode hoops. + assert url is not None assert '?' in url url += '&' + request.META['QUERY_STRING'] return redirect(url) @@ -198,6 +199,7 @@ def patch_bot_backend( if service_payload_url is not None: check_valid_interface_type(service_interface) + assert service_interface is not None do_update_outgoing_webhook_service(bot, service_interface, service_payload_url) if config_data is not None: