archivesspace
archivesspace copied to clipboard
User preferences page crashes if repository isn't selected.
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)
- Start empty ASpace (e.g. run with demo db
- Visit user preferences page
Context
Not directly affected, discovered during testing.
Your Environment
- Version used: current master as of 2020-03-27
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.