-
Notifications
You must be signed in to change notification settings - Fork 106
fix: extend custom timezone mapping list #949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Updated customTimeZoneList to include additional timezone entries. Log: extend custom timezone mapping list pms: BUG-338797
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe pull request updates the SetTimezone handler to extend its hard-coded customTimeZoneList by adding the Asia/Urumqi entry, ensuring that selecting this zone will map to Asia/Shanghai like the other custom zones. Class diagram for updated SetTimezone logicclassDiagram
class Manager {
+SetTimezone(sender, timezone, message) *dbus.Error
}
Flow diagram for custom timezone mapping updateflowchart TD
A["User selects timezone"] --> B["Is timezone in customTimeZoneList?"]
B -->|Yes| C["Map to Asia/Shanghai"]
B -->|No| D["Use selected timezone"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deepin pr auto review我来对这个diff进行审查:
改进建议的代码示例: // 包级别常量
var customTimeZoneMap = map[string]bool{
"Asia/Chengdu": true,
"Asia/Beijing": true,
"Asia/Nanjing": true,
"Asia/Wuhan": true,
"Asia/Xian": true,
"Asia/Urumqi": true,
}
func (m *Manager) SetTimezone(sender dbus.Sender, timezone, message string) *dbus.Error {
// 验证时区有效性
if timezone == "" {
return dbusutil.ToError(errors.New("empty timezone"))
}
if err := m.checkAuthorization(sender, managerPolicyActionId); err != nil {
return dbusutil.ToError(err)
}
// 使用map优化查找性能
if customTimeZoneMap[timezone] {
timezone = "Asia/Shanghai"
}
// 其余代码保持不变...
}这个改进版本:
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: fly602, wyu71 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/forcemerge |
|
This pr force merged! (status: unstable) |
Log: extend custom timezone mapping list
pms: BUG-338797
Summary by Sourcery
Bug Fixes: