Skip to content

Simplifying IUser interface #251

@brichet

Description

@brichet

The "source of truth" for identity and users in Jupyter comes from the Jupyter Server identity module here. This has the following attributes (ignoring color, avatar, initials):

username: str  # the only truly required field

# these fields are filled from username if not specified, name is the 'real' name of the user
name: str = ""
# display_name is a shorter name for us in UI, if different from name. e.g. a nickname
display_name: str = ""

The key here is that the username is the unique field and when hooked up to an identity provider (such as Github/Google oauth) it takes a value that matches the username of the underlying identity provider (for example, username=ellisonbg for me on GitHub).

The IUser class in Jupyter chat matches this data model exactly, but adds mention_name and bot. I believe the IUser class in jupyter_chat (both server and frontend) should match that of the Jupyter Server User class.

Why did we introduce mention_name? I suspect (please correct me if I am wrong) that we introduced mention_name because the default random anonymous Identity Provider ("Anonymous ") choose to use uuids for the username. While these approach satisfies the requirement of uniqueness, it doesn't satisfy the usual requirement that usernames are also human friendly. Because username didn't meet this human friendly requirement, we needed another name that did (with the logic let mention_name = this.display_name || this.name || this.username;).

Based on this, I would propose the following:

  1. Submit a PR to Jupyter Server that ensures the default random anonymous identity provider uses usernames that are both unique and human friendly (I don't mind doing this, it is a minor change).
  2. Remove mention_name from the jupyter_chat IUser interface and use username as the human readable, unique name that is used for at mentioning. With this change, Jupyter chat will follow the pattern that is used by other applications familiar to Jupyter users (GitHub, Slack, etc.).
  3. Maybe move bot: bool down into Jupyter Server as well (less clear on this one, but definitely makes things simple).

Let me know what people think and I can submit the PR to Jupyter Server.

Originally posted by @ellisonbg in #245

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions