]> source.dussan.org Git - gitea.git/commit
Allow custom "created" timestamps in user creation API (#22549)
authorSybren <122987084+drsybren@users.noreply.github.com>
Thu, 16 Feb 2023 16:32:01 +0000 (17:32 +0100)
committerGitHub <noreply@github.com>
Thu, 16 Feb 2023 16:32:01 +0000 (10:32 -0600)
commitaa45777c926adba2bbe9e269960476acf55abb33
treebcf28d4a45eb80c9598b827b6c7bc284416b0790
parenta0b9767df8720578910d49437db37dc34821bd0b
Allow custom "created" timestamps in user creation API (#22549)

Allow back-dating user creation via the `adminCreateUser` API operation.
`CreateUserOption` now has an optional field `created_at`, which can
contain a datetime-formatted string. If this field is present, the
user's `created_unix` database field will be updated to its value.

This is important for Blender's migration of users from Phabricator to
Gitea. There are many users, and the creation timestamp of their account
can give us some indication as to how long someone's been part of the
community.

The back-dating is done in a separate query that just updates the user's
`created_unix` field. This was the easiest and cleanest way I could
find, as in the initial `INSERT` query the field always is set to "now".
models/user/user.go
models/user/user_test.go
modules/structs/admin_user.go
routers/api/v1/admin/user.go
templates/swagger/v1_json.tmpl