Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1342603 - Timezone is saved as an empty string instead of nil after changing to a timezone and back to "Browser timezone"
Summary: Timezone is saved as an empty string instead of nil after changing to a timez...
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: WebUI
Version: Nightly
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: Unspecified
Assignee: Shlomi Zadok
QA Contact: Roman Plevka
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-03 16:07 UTC by Walden Raines
Modified: 2019-09-26 16:20 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-13 20:18:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 15285 0 Normal New Timezone is saved as an empty string instead of nil after changing to a timezone and back to "Browser timezone" 2021-01-08 17:50:53 UTC

Description Walden Raines 2016-06-03 16:07:52 UTC
It appears as if when saving a user as "Browser Timezone" after changing the timezone to something other than "Browser Timezone" that the value is saved as an empty string instead of nil.

Check it out:

katello=# select count(id) from users where timezone = '';
 count 
-------
     1
(1 row)

(byebug) cookies[:timezone]
"America/New_York"
(byebug) User.current.try(:timezone)
""

Which will obviously cause this time zone code [1]:

client_timezone  = User.current.try(:timezone) || cookies[:timezone]
Time.zone        = client_timezone if client_timezone.present?

to not set the correct timezone since User.current.try(:timezone) will be true and thus client_timezone.present? will be false.

h3. Steps to Reproduce

# Change a user's timezone to something other than "Browser timezone"
# Change the same user's timezone back to "Browser timezone"
# Note that user.timezone is an empty string

[1] https://github.com/theforeman/foreman/blob/develop/app/controllers/concerns/application_shared.rb#L9-L13

Comment 1 Walden Raines 2016-06-03 16:07:54 UTC
Created from redmine issue http://projects.theforeman.org/issues/15285

Comment 3 Bryan Kearney 2016-06-03 18:17:27 UTC
Upstream bug component is WebUI

Comment 4 Roman Plevka 2016-06-30 11:41:14 UTC
I believe the proper fix would be to update the model (or controller?) to set the value to null in case it gets "".
As one can pass an empty string even from API or Hammer.
I believe we want to mimic the behaviour of the 'locale' attribute. which is also null by default, but it even stays null if one updates it to an empty string.

Comment 5 Bryan Kearney 2016-07-26 15:25:24 UTC
Moving 6.2 bugs out to sat-backlog.

Comment 6 Bryan Kearney 2016-07-26 15:28:14 UTC
Moving 6.2 bugs out to sat-backlog.

Comment 8 Bryan Kearney 2016-09-25 16:16:24 UTC
Upstream bug assigned to szadok

Comment 9 Bryan Kearney 2016-09-25 16:16:28 UTC
Upstream bug assigned to szadok

Comment 10 Bryan Kearney 2017-03-13 20:18:11 UTC
This has been copied to an issue upstream. When the upstream issue is fixed, the next version of satellite will contain it. We will no longer track this downstream.


Note You need to log in before you can comment on or make changes to this bug.