-
Notifications
You must be signed in to change notification settings - Fork 55
refactor: update notification handling and data access logic #1181
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
Reviewer's GuideRefactor DataAccessorProxy to consistently manage and route operations through m_source by initializing it properly, removing redundant validity checks, and simplifying CRUD return logic; and update NotifyStagingModel to replace BubbleNotifyItem with AppNotifyItem for notification creation and initialization. Class diagram for NotifyStagingModel notification item refactorclassDiagram
class NotifyStagingModel {
- QList<AppNotifyItem*> m_appNotifies
+ void remove(qint64 id)
+ void open()
}
class AppNotifyItem {
+ AppNotifyItem(NotifyEntity entity)
}
%% BubbleNotifyItem is removed from usage
%% Previously: class BubbleNotifyItem { + BubbleNotifyItem(NotifyEntity entity) }
NotifyStagingModel --> AppNotifyItem : uses
Class diagram for DataAccessorProxy CRUD logic refactorclassDiagram
class DataAccessorProxy {
- DataAccessor* m_impl
- DataAccessor* m_source
+ addEntity(entity)
+ replaceEntity(id, entity)
+ updateEntityProcessedType(id, type)
+ fetchEntity(id)
+ fetchEntityCount(appName, type)
+ fetchLastEntity(appName, type)
+ fetchEntities(appName, type, maxCount)
+ fetchApps(maxCount)
+ removeEntity(id)
+ removeEntityByApp(appName)
+ clear()
+ setSource(source)
}
class DataAccessor {
+ addEntity(entity)
+ replaceEntity(id, entity)
+ updateEntityProcessedType(id, type)
+ fetchEntity(id)
+ fetchEntityCount(appName, type)
+ fetchLastEntity(appName, type)
+ fetchEntities(appName, type, maxCount)
+ fetchApps(maxCount)
+ removeEntity(id)
+ removeEntityByApp(appName)
+ clear()
+ isValid()
}
class MemoryAccessor {
+ isValid()
}
DataAccessorProxy --> DataAccessor : uses as m_impl
DataAccessorProxy --> DataAccessor : uses as m_source
MemoryAccessor --|> DataAccessor
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.
Hey @18202781743 - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
1. Changed BubbleNotifyItem to AppNotifyItem in NotifyStagingModel for better naming consistency 2. Simplified DataAccessorProxy by removing redundant source validity checks 3. Improved entity routing logic with clearer conditions 4. Added proper source initialization in DataAccessorProxy constructor 5. Enhanced removeEntity() to check entity validity before removal 6. Streamlined clear() and removeEntityByApp() to only operate on source The changes improve code maintainability and reduce redundant checks while maintaining the same functionality. The naming change from BubbleNotifyItem to AppNotifyItem better reflects the item's purpose, and the data access logic simplification makes the code more straightforward and less error-prone. refactor: 更新通知处理和数据访问逻辑 1. 在 NotifyStagingModel 中将 BubbleNotifyItem 改为 AppNotifyItem 以提高 命名一致性 2. 通过移除冗余的源有效性检查简化了 DataAccessorProxy 3. 使用更清晰的条件改进了实体路由逻辑 4. 在 DataAccessorProxy 构造函数中添加了适当的源初始化 5. 增强了 removeEntity() 在删除前检查实体有效性 6. 简化了 clear() 和 removeEntityByApp() 使其仅操作源数据 这些变更提高了代码可维护性,在保持相同功能的同时减少了冗余检查。从 BubbleNotifyItem 到 AppNotifyItem 的命名更改更好地反映了项目的用途,数据 访问逻辑的简化使代码更加直接且不易出错。 pms: BUG-305735
deepin pr auto review代码审查意见:
综上所述,代码修改是合理的,但需要确保这些修改符合业务逻辑需求,并且对代码质量、性能和安全性进行了适当的考虑。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, yixinshark 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 |
better naming consistency
checks
The changes improve code maintainability and reduce redundant
checks while maintaining the same functionality. The naming change
from BubbleNotifyItem to AppNotifyItem better reflects the item's
purpose, and the data access logic simplification makes the code more
straightforward and less error-prone.
refactor: 更新通知处理和数据访问逻辑
命名一致性
这些变更提高了代码可维护性,在保持相同功能的同时减少了冗余检查。从
BubbleNotifyItem 到 AppNotifyItem 的命名更改更好地反映了项目的用途,数据
访问逻辑的简化使代码更加直接且不易出错。
pms: BUG-305735