Remove default value for time zone user preference
📖 What does this MR do?
Related to #340795 (closed)
In gitlab-foss!26554 (merged) we added a timezone
column to the user_preferences
table. In !66493 (merged) we used the timezone
value to display a user's local time on their profile. One issue we ran into is that since timezone
defaults to UTC
there is no way to tell if a user has explicitly set their timezone and therefore we always display local time on a user's profile. This can cause confusion because if a user has not explicitly set their timezone local time is displayed in UTC on their profile. Furthermore there is currently no way for a user to clear their timezone so that local time is not displayed on their profile.
This MR aims to solve these issues by implementing the following changes:
- Remove the
default_value_for
statement so atimezone
value is not set for new users. - Modify the time zone dropdown to allow an empty value
- Add an option to the dropdown to allow users to clear their timezone
- Only display local time on a user's profile if they have set their timezone
The only other place TimezoneDropdown
is used is on the pipelines schedules page. I have included screenshots below to show that it has not changed.
📷 Screenshots
View | Before | After |
---|---|---|
Profile with time zone set | ||
Profile without time zone set | ||
Edit profile time zone selected | ||
Edit profile time zone not selected | ||
New pipeline schedule (no changes) |
💻 How to setup and validate locally
- Login as an admin (
root
on GDK). - Navigate to
admin/users/new
and fill out the form. - Find the newly created user in
/admin/users
and clickImpersonate
. - Navigate to your profile. Local time should not be displayed.
- Navigate to
/-/profile
and select a time zone. Save the form. - Navigate to your profile. Local time should be displayed.
🚦 MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.