Skip to content

Resolve "Does not set `projects_limit` to 10 when creating user via API"

What does this MR do?

  • Removes default value from users.projects_limit
  • Adds NOT NULL constraint to users.projects_limit
  • Simplifies the set_projects_limit after_initialize callback in the User model

Are there points in the code the reviewer needs to double check?

I added the original issue as a test in user_spec, but I'm not sure if it should be added at all (line 819)

Why was this MR needed?

See #31995 (closed)

Without these changes, a new User cannot be created with a projects_limit value that matches the DB default because it will be overridden with the current_application_settings.default_projects_limit because ActiveRecord's *_changed? methods return false if the value being set matches the DB default.

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #31995 (closed)

Edited by Dmytro Zaporozhets (DZ)

Merge request reports