• Lyza Danger Gardner's avatar
    Restructure focus-mode internal state and reduce API · 9f481f80
    Lyza Danger Gardner authored
    Refactor the way that focus-mode configuration is represented
    in state and whittle down the API (selectors and actions) a little
    for clarity.
    
    Reduce the object depth for the focus-mode state. Use a single
    function to configure focus mode. Concede that user-focus is the
    only focus mode for now, and as such valid focus-mode configuration
    must contain a (valid) user object.
    
    Note: There is still some lingering inconsistency in the user
    identifiers provided by the LMS app. Canvas speedgrader uses app
    settings to configure focus mode (`js-config` object) and sets
    the `username` property of the `user` object to a username-
    formatted value (i.e. a username, no authority indicated). Non-
    Canvas graders do not configure focus mode via the settings,
    but instead dispatch RPC messages. These pass a `username`
    property whose value is formatted like a userId
    (`acct:<username>@authority>`) but it still provided via
    the `username` property.
    
    AFAIK, nobody/no service sends a `userid` property in the
    focus-mode user object, but we document that we do support
    it so I've left it extant until we figure this out.
    9f481f80
focused-mode-header.js 1.53 KB