zulip/zerver/views
Steve Howell 80c057d91d REQ: Use check_dict_only in update_user_backend.
Update the REQ check for profile_data in
update_user_backend by tweaking `check_profile_data`
to use `check_dict_only`.

Here is the relevant URL:

    path('users/<int:user_id>', rest_dispatch,
         {'GET': 'zerver.views.users.get_members_backend',

It would be nice to unify the validator
for these two views, but they are different:

    update_user_backend
    update_user_custom_profile_data

It's not completely clear to me why update_user_backend
seems to support a superset of the functionality
of `update_user_custom_profile_data`, but it has
this code to allow you to remove custom profile fields:

    clean_profile_data = []
    for entry in profile_data:
        assert isinstance(entry["id"], int)
        if entry["value"] is None or not entry["value"]:
            field_id = entry["id"]
            check_remove_custom_profile_field_value(target, field_id)
        else:
            clean_profile_data.append({
                "id": entry["id"],
                "value": entry["value"],
            })

Whereas the other view is much simpler:

def update_user_custom_profile_data(
    <snip>
) -> HttpResponse:

    validate_user_custom_profile_data(user_profile.realm.id, data)
    do_update_user_custom_profile_data_if_changed(user_profile, data)
    # We need to call this explicitly otherwise constraints are not check
    return json_success()
2020-06-25 10:54:15 -07:00
..
development python: Convert more percent formatting to Python 3.6 f-strings. 2020-06-14 23:27:22 -07:00
__init__.py views: Rename __init__.py to zerver.views.registration. 2017-01-08 16:21:15 -08:00
alert_words.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
archive.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
attachments.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
auth.py fetch_api_key: Return `email` in json_response. 2020-06-24 15:13:31 -07:00
camo.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
compatibility.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
custom_profile_fields.py REQ: Check value in update_user_custom_profile_data. 2020-06-25 10:54:15 -07:00
digest.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
documentation.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
email_mirror.py email-mirror-postfix: Handle 8-bit messages correctly. 2020-06-14 20:24:06 -07:00
events_register.py events_register_backend: Validate client_capabilities type correctly. 2020-06-20 22:29:15 -07:00
home.py people: Enable `user_avatar_url_field_optional` in webapp. 2020-06-24 10:06:35 -07:00
hotspots.py python: Convert percent formatting to .format for translated strings. 2020-06-15 16:24:46 -07:00
invite.py invite: Add option to invite user as an organization owner. 2020-06-20 23:04:59 -07:00
message_edit.py views: Extract message_edit.py for message editing views. 2020-06-22 15:08:34 -07:00
message_fetch.py validator: Fix type errors hidden by bad Any use in set_type_structure. 2020-06-23 16:30:17 -07:00
message_flags.py views: Extract message_flags.py for flags views. 2020-06-22 15:08:34 -07:00
message_send.py message_send: Avoid unchecked cast. 2020-06-23 13:30:09 -07:00
muting.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
pointer.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
portico.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
presence.py python: Convert percent formatting to .format for translated strings. 2020-06-15 16:24:46 -07:00
push_notifications.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
reactions.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
realm.py realm: Fix type-checking for message_retention_days. 2020-06-24 11:01:34 -07:00
realm_domains.py python: Convert percent formatting to .format for translated strings. 2020-06-15 16:24:46 -07:00
realm_emoji.py python: Convert percent formatting to .format for translated strings. 2020-06-15 16:24:46 -07:00
realm_export.py python: Convert percent formatting to .format for translated strings. 2020-06-15 16:24:46 -07:00
realm_filters.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
realm_icon.py python: Convert percent formatting to .format for translated strings. 2020-06-15 16:24:46 -07:00
realm_logo.py python: Convert percent formatting to .format for translated strings. 2020-06-15 16:24:46 -07:00
registration.py confirmation: Pass realm rather than host to confirmation_url. 2020-06-14 23:27:22 -07:00
report.py python: Manually convert more percent-formatting to f-strings. 2020-06-14 23:27:22 -07:00
storage.py update_storage: Validate storage type correctly. 2020-06-20 22:29:15 -07:00
streams.py org settings: Use 'forever' value instead of -1 for message_retention_days. 2020-06-24 10:38:58 -07:00
submessage.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
thumbnail.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
tutorial.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
typing.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
unsubscribe.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
upload.py python: Convert percent formatting to .format for translated strings. 2020-06-15 16:24:46 -07:00
user_groups.py python: Convert percent formatting to .format for translated strings. 2020-06-15 16:24:46 -07:00
user_settings.py settings: Add automatic theme detection feature. 2020-06-21 01:09:01 -07:00
users.py REQ: Use check_dict_only in update_user_backend. 2020-06-25 10:54:15 -07:00
video_calls.py video_calls: Annotate a type: ignore with a specific bug URL. 2020-06-23 11:29:54 -07:00
zephyr.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00