Skip to content

Change account verification flow to use simple myUserInfo to enable logged-in required items. #2175

Description

@dessalines

Pre-Flight checklist

  • Did you check to see if this issue already exists?
  • This is a single feature request. (Do not put multiple feature requests in one issue)
  • This is not a question or discussion. (Use https://lemmy.ml/c/jerboa for that)

Describe The Feature Request Below

Nearly every lemmy API action which requires an account, is currently surrounded by:

account.doIfReadyElseDisplayInfo(
  appState,
  ctx,
  resources,
  snackbarHostState,
  scope,
  myUserInfoViewModel, (previously SiteViewModel)
  accountViewModel,
) {
  • This account verification does a lot of altering and refetching of both the accountViewModel, and the Site/MyUserInfoViewModel, which is dangerous for screens which should not be changing accounts or resetting account info.
  • Its cumbersome because now every screen requires many viewModels, which they should really only be reading.

Some recommendations:

  • These checks should not really be done just to display or not display buttons, but should only be run on startup or account change.
  • Buttons should use myUserInfo != null to determine whether to enable or disable buttons, or hide them entirely. This simple check is how lemmy-ui handles all login-related items.
  • The AccountViewModel should probably take in the myUserInfoViewModel and siteViewModels as props, so that it can set them directly when switching accounts, rather than those viewmodels each using flows to watch the accountViewModel.
  • It might be necessary to create a dedicated Logging In / Verifying screen, so that when switching accounts from the sidebar, the current screen doesn't need to take in and alter all these viewModels.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    2 - low/medium priorityThis issue is not planned to be implemented soonenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions