New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Give SINGLE_USER a chance to register #1820
Conversation
Looks like controller helper_method is a trick that the test suite does not like, will have a look at it |
Instead of doing this check on every request, could we improve the docs to make it more clear that single user instances need to create accounts prior to being able to use the app? |
@@ -69,6 +69,10 @@ def unprocessable_entity | |||
end | |||
end | |||
|
|||
def single_user_mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest renaming this to single_user_mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was that in my first draft :) thanks
@@ -69,6 +69,10 @@ def unprocessable_entity | |||
end | |||
end | |||
|
|||
def single_user_mode | |||
Rails.configuration.x.single_user_mode && Account.first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this could be @single_user_mode ||= Rails.configuration.x.single_user_mode && Account.first
for multiple calls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't mean to click approve, meant to click reqest changes
I was thinking about spitting out the error message instead. Is the Account.first check expensive? If yes, then we could store the result somewhere? |
@mjankowski The DB check only occurs when single user mode is enabled, and it would occur anyway for the redirect to the right profile, so I think that's not a big deal |
An attempt to open a brand new Mastodon instance configured as SINGLE_USER_MODE=true will cause an exception. Enable temporary registration if we have no users in the database Fixes mastodon#1817
Wow, thanks. I've tried to fix the tests by doing
but causes the |
@saper Right, I am still encountering the test issue. Really annoying. Any solution? |
Never mind, found a hacky way to fix those tests. |
Nice. What would be the proper way ? Providing spec for application controller? |
An attempt to open a brand new Mastodon instance configured as SINGLE_USER_MODE=true will cause an exception. Enable temporary registration if we have no users in the database Fixes mastodon#1817
An attempt to open a brand new Mastodon instance configured
as SINGLE_USER_MODE=true will cause an exception.
Enable temporary registration if we have no users in the database
Fixes #1817