Repository navigation
fix(caldav): disable schedule type creation for third-party accounts - #374
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
Reviewer's GuideDisables schedule-type creation and management for third-party CalDAV accounts across settings and new-event dialogs through UI state control and defensive creation guards, while preserving existing schedule types and the original functionality for local and UOS ID accounts. Sequence diagram for CalDAV schedule type creation preventionsequenceDiagram
participant User
participant JobTypeComboBox
participant CScheduleDlg
participant Account
User->>JobTypeComboBox: updateJobType(Account)
JobTypeComboBox->>Account: accountType()
Account-->>JobTypeComboBox: Account_CalDav
JobTypeComboBox->>JobTypeComboBox: setAddTypeEnabled(false)
JobTypeComboBox-->>User: Add control disabled
User->>JobTypeComboBox: slotBtnAddItemClicked()
JobTypeComboBox-->>User: Return without creating type
User->>CScheduleDlg: selectScheduleType()
CScheduleDlg->>JobTypeComboBox: isEditable()
JobTypeComboBox-->>CScheduleDlg: false
CScheduleDlg-->>User: Creation unavailable
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Disable schedule type creation for CalDAV accounts in settings and new event dialogs. Keep schedule type creation available for local accounts and UOS ID accounts. 在账户设置和新建日程窗口中禁用第三方 CalDAV 账户新增日程类型。 保留本地账户和 UOS ID 账户的日程类型新增功能。 Log: 限制第三方账户新增日程类型 PMS: TASK-393989 Influence: 禁止第三方 CalDAV 账户新增日程类型,避免创建无法同步或不应修改的类型, 同时保持本地账户和 UOS ID 账户的原有功能不变。
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 语法正确,逻辑清晰,边界处理完善。新增 setAddTypeEnabled 方法正确封装了启用/禁用逻辑,slotBtnAddItemClicked 中的防御性检查有效防止了禁用状态下的类型创建。showPopup 中将 hide() 改为 setVisible() 实现了双向可见性控制,修复了原有逻辑仅隐藏不恢复的缺陷。scheduledlg.cpp 中新增 m_accountItem->getAccount() 空指针检查提升了代码安全性。 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 代码结构清晰,注释完整。新增的 setAddTypeEnabled 方法合理封装了按钮和编辑状态的同步管理。settingdialog.cpp 中通过 findChild 获取 moreButton 并禁用的方式与现有代码风格一致。翻译文件中 '账号' 到 '账户' 的修改提升了术语一致性。qCDebug/qCWarning 日志输出符合 Qt 项目规范。 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 性能良好,资源使用合理。所有变更均为简单的布尔判断和 UI 状态更新,算法复杂度合理,无性能瓶颈。findChild 调用仅在账户切换时触发,不在高频路径上,性能影响可忽略。 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 存在0个安全漏洞。本次变更未引入任何安全风险。新增的空指针检查(m_accountItem->getAccount())提升了代码的防御性。CalDAV 账户类型判断使用枚举值比较,无注入风险。无硬编码密钥、无敏感信息泄露、无用户输入未校验问题。 💡 改进建议代码示例// 本次代码变更质量优秀,无需改进示例。
// setAddTypeEnabled 方法设计清晰,防御性检查到位:
void JobTypeComboBox::setAddTypeEnabled(bool enabled)
{
m_addTypeEnabled = enabled;
if (!enabled && isEditable()) {
setEditable(false);
setIconSize(QSize(16, 16));
}
if (m_addBtn) {
m_addBtn->setEnabled(enabled);
if (!enabled) {
m_addBtn->setHighlight(false);
}
}
}
// slotBtnAddItemClicked 中的防御性检查:
void JobTypeComboBox::slotBtnAddItemClicked()
{
if (!m_addTypeEnabled) {
qCDebug(ClientLogger) << "Adding schedule type is disabled";
return;
}
// ...
}本报告由 AI 代码审查工具自动生成 |
Disable schedule type creation for CalDAV accounts in settings and new event dialogs. Keep schedule type creation available for local accounts and UOS ID accounts.
在账户设置和新建日程窗口中禁用第三方 CalDAV 账户新增日程类型。
保留本地账户和 UOS ID 账户的日程类型新增功能。
Log: 限制第三方账户新增日程类型
PMS: TASK-393989
Influence: 禁止第三方 CalDAV 账户新增日程类型,避免创建无法同步或不应修改的类型, 同时保持本地账户和 UOS ID 账户的原有功能不变。
Summary by Sourcery
Restrict schedule type creation for CalDAV accounts while retaining existing functionality for supported local and UOS ID accounts.
Bug Fixes:
Enhancements:
Chores: