archivesspace icon indicating copy to clipboard operation
archivesspace copied to clipboard

User preferences page crashes if repository isn't selected.

Open pobocks opened this issue 4 years ago • 1 comments

If a user doesn't have a current repository selected, the user preferences page will crash with a 500 error.

This is especially serious with addition of per-user locale preferences, as this prevents a user from setting the language prior to creating the initial repository, which could be an impediment to setup, tagging @mark-cooper due to this context

Expected Behavior

Prefs page should come up, with repository-specific settings omitted/greyed out.

Current Behavior

Preference page crashes with following error in logs:

RuntimeError (Template substitution was incomplete: '/repositories/:repo_id/preferences'):

app/controllers/preferences_controller.rb:28:in `edit'
Completed 500 Internal Server Error in 231ms

Possible Solution

Steps to Reproduce (for bugs)

  1. Start empty ASpace (e.g. run with demo db
  2. Visit user preferences page

Context

Not directly affected, discovered during testing.

Your Environment

  • Version used: current master as of 2020-03-27

pobocks avatar Mar 27 '20 18:03 pobocks

FWIW, on briefly investigating this, it does appear this has been the case at least as far back as v2.6.0 (likely further, but that's as far back as I went).

I agree that this problem is of greater importance with the addition of new preference options (especially languages), but the underlying issue is not newly introduced.

I would assume a reasonable solution would be:

  • Hide the dropdown for setting repo preferences altogether when there's no active repo (well, when the active repo is the global repo 0);
  • Implement a fix in preferences_controller to handle user preferences for a user that currently exists in the global repo.

lorawoodford avatar Aug 04 '20 18:08 lorawoodford