Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

users reducer: Handle all user updates from realm_user op: update #5386

Merged
merged 7 commits into from
May 23, 2022

Commits on May 20, 2022

  1. eventToAction [nfc]: Express a conditional differently

    This will let us do an `else if`.
    chrisbobbe committed May 20, 2022
    Configuration menu
    Copy the full SHA
    b0bf0a4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8471961 View commit details
    Browse the repository at this point in the history
  3. users state [nfc]: Pass realm_user update events through more directly

    Following the generic "server event" pattern Greg started in
    979d283. We still convert avatar_url to our special AvatarURL form
    at the edge, in eventToAction, for crunchy shell:
      https://github.com/zulip/zulip-mobile/blob/master/docs/architecture/crunchy-shell.md
    
    Also, give a Flow type to the event itself as we receive it from the
    server: RealmUserUpdateEventRaw. We should keep this up-to-date with
    the server API documentation. (We also have RealmUserUpdateEvent,
    for the slightly processed form that has AvatarURL.)
    
    We still keep the behavior of only allowing avatar_url and role
    changes to apply to the state [1]. But now, that code is in
    usersReducer instead of eventToAction. For the reducer tests that
    simulate actions changing *other* user data, that means they'd now
    fail. So, skip them, with a plan to re-enable.
    
    [1] Because we've been wary of accepting server data that we haven't
        vetted; see 7296551. The API doc seems to have been improved
        since then, and now we've written down a type for it. So now we
        can proceed more confidently, which is nice!
    chrisbobbe committed May 20, 2022
    Configuration menu
    Copy the full SHA
    3b3dbfd View commit details
    Browse the repository at this point in the history

Commits on May 21, 2022

  1. users reducer tests [nfc]: Fill out user-update tests (still skipped)

    The reducer still doesn't handle all these cases, so we can't
    un-skip them yet. But now at least we're prepared to cover all the
    cases once the reducer *does* handle them, soon.
    
    See the list of cases in the doc:
      https://zulip.com/api/get-events#realm_user-update
    
    The removed comment was wrong to say that we should exclude a test
    for bot-owner changes. The users state doesn't include cross-realm
    bots, it's true. But it does include regular bots, and those are the
    bots that have owners.
    chrisbobbe committed May 21, 2022
    Configuration menu
    Copy the full SHA
    d64b2b2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d7c57df View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    32da02a View commit details
    Browse the repository at this point in the history

Commits on May 23, 2022

  1. realm_user event: Fix custom_profile_field.value to be string | null

    See zulip/zulip#22103, which I sent after
    observing that this was sometimes null.
    chrisbobbe committed May 23, 2022
    Configuration menu
    Copy the full SHA
    5dc4770 View commit details
    Browse the repository at this point in the history