/spend quick_action fails if Timezone is empty string
Summary
If you try to add spend time on an issue via the /spend quick_action and do not have a timezone set in your profile, the quick_action fails with a 500¹ and a internal server error².
Steps to reproduce
Set the timezone for a user to an empty string. We do not know yet why this happens as for some users with an empty profile timezone the value is nil and for some users the value is "".
What is the current bug behaviour?
In the rails log we got the ArgumentError Invalid Timezone:, which traces down to this line
The real issue happens in this line, as the code tries to get the "user profile timezone" and if not set it uses the instance default timezone.
But we have the issue that when a user has no timezone set, the value is not always nil but sometime an empty string:
User.where(username: "Gitbot").first.timezone
=> nil
User.where(username: "redacted.username").first.timezone
=> ""
This will then result in the internal server error, as the code is only valid when the user profiles timezone is nil or a valid timezone.
User.where(username: "Gitbot").first.timezone || Time.zone.name
=> "UTC"
User.where(username: "redacted.username").first.timezone || Time.zone.name
=> ""
What is the expected correct behaviour?
The quick_action /spend should also work for users, which do not have set the timezone in their profile.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
GitLab information Version: 18.1.2-ee Revision: cd9f1ac5ba9
Possible fixes
The line to initialize the timezone for the /spend quick_action should not only check if the users value is nil but also if the value is a empty string.
line

