Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When implementing the active users metric (#3844), I noticed that Aleph currently updates the
role.updated_at
column every time a user logs in – so I took the shortcut and simply used that to count the number of users that logged in at least once within a specific period of time. But it turns out thatupdated_at
is only updated on login when using password auth. It isn’t updated when signing in via OAuth, and consequently the active users metric is incorrect when OAuth is used for authentication.I’m fixing this by adding a separate timestamp column that stores when a user last logged in. It’s probably a good idea to make the intent clear (Just reading the name updated_at, most people probably wouldn’t expect that timestamp to be set every time a user logs in.)
Note: This currently doesn’t include a test for the expected behavior when logging in via OAuth. There have been lots of changes to authentication testing on the
develop
branch that are not present inrelease/4.0.0
, so any changes would lead to annoying merge conflicts later on. I have created a follow-up task to add a separate test for OAuth logins once the 4.0.0 release is out. You can manually test the behavior by configuring your development environment to use an OAuth provider.