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

Store state.accounts[].realm as a WHATWG URL object. #4235

Merged
merged 10 commits into from
Sep 22, 2020

Commits on Sep 22, 2020

  1. webview: Prepare to "revive" realm in handleInitialLoad.

    In an upcoming commit, we'll change the `Auth` type to have a URL
    object for the realm. We call `JSON.stringify` on the arguments
    passed to `handleInitialLoad`. For the `realm` property, this means
    it'll be a string URL, not a URL object. Here, we pick it out in
    preparation for "reviving" it back into its URL form in the body of
    `handleInitialLoad`.
    chrisbobbe committed Sep 22, 2020
    Configuration menu
    Copy the full SHA
    c53def3 View commit details
    Browse the repository at this point in the history
  2. store: Replace/revive URL instances.

    Like we did in bfe7949, for ZulipVersion instances. We don't store
    any of these in Redux yet, but we will soon.
    chrisbobbe committed Sep 22, 2020
    Configuration menu
    Copy the full SHA
    565e23e View commit details
    Browse the repository at this point in the history
  3. accounts: Make Auth.realm a URL object, including in state.accounts.

    Changing the `Auth` type implicitly changes the `Account` and
    `Identity` types, too.
    
    Done with an effort to minimize unnecessary follow-on changes in
    this commit. Here, we don't propagate the realm in its URL form as
    far toward the eventual consumers of the realm as we'll eventually
    want to; we'll do that in upcoming commits.
    
    Wherever two realm values are compared for equality with `===`, we
    make sure they are both stringified first. Flow didn't warn about
    these cases, so we caught them in test failures and by scanning
    through a full-project search for the term 'realm'.
    chrisbobbe committed Sep 22, 2020
    Configuration menu
    Copy the full SHA
    865914f View commit details
    Browse the repository at this point in the history
  4. webAuth: Pipe Account[0].realm as URL down to authFromCallbackUrl.

    As we'll do in some upcoming commits, stringify the realm exactly
    where we need it as a string.
    
    This slightly expands the area of our codebase in which it's easy to
    see that the realm is well-formed data.
    chrisbobbe committed Sep 22, 2020
    Configuration menu
    Copy the full SHA
    a3a8317 View commit details
    Browse the repository at this point in the history
  5. react: Pipe Account[].realm as URL to some React-component consumers.

    As in the previous and next commits, stringify the realm exactly
    where we need it as a string.
    
    This slightly expands the area of our codebase in which it's easy to
    see that the realm is well-formed data.
    chrisbobbe committed Sep 22, 2020
    Configuration menu
    Copy the full SHA
    e5972a2 View commit details
    Browse the repository at this point in the history
  6. avatar: Pipe Account[0].realm as URL down to getAvatarUrl.

    As in the previous and next commits, stringify the realm exactly
    where we need it as a string.
    
    This slightly expands the area of our codebase in which it's easy to
    see that the realm is well-formed data.
    
    `getAvatarUrl` itself will likely disappear soon, when we make the
    shell crunchier for handling `.avatar_url` on users, cross-realm
    bots, and messages.
    
    But the changes we make to its callers, here, will continue to be
    beneficial after that.
    chrisbobbe committed Sep 22, 2020
    Configuration menu
    Copy the full SHA
    c852dd8 View commit details
    Browse the repository at this point in the history
  7. getServerSettings: Pipe realm as URL down.

    As in the previous and next commits, stringify the realm exactly
    where we need it as a string.
    
    This slightly expands the area of our codebase in which it's easy to
    see that the realm is well-formed data.
    
    Also rename `this.state.realm` to `this.state.realmInputValue`, to
    be more descriptive.
    chrisbobbe committed Sep 22, 2020
    Configuration menu
    Copy the full SHA
    d04af75 View commit details
    Browse the repository at this point in the history
  8. url, internalLinks: Pipe realm as URL to isUrlOnRealm, `getPathsFro…

    …mUrl`.
    
    As in the previous and next commits, stringify the realm exactly
    where we need it as a string.
    
    This slightly expands the area of our codebase in which it's easy to
    see that the realm is well-formed data.
    chrisbobbe committed Sep 22, 2020
    Configuration menu
    Copy the full SHA
    458dee2 View commit details
    Browse the repository at this point in the history
  9. redux: In REALM_ADD and LOGIN_SUCCESS, make realm be a URL object.

    As in the preceding handful of commits, stringify the realm exactly
    where we need it as a string.
    
    These should be the last sites in which it's not totally clear that
    the realm is well-formed data.
    chrisbobbe committed Sep 22, 2020
    Configuration menu
    Copy the full SHA
    ed1be64 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    05e24ee View commit details
    Browse the repository at this point in the history