Skip to content

Conversation

@18202781743
Copy link
Contributor

@18202781743 18202781743 commented Jul 8, 2025

  1. Added sorting of notification entities by creation time (cTime) in
    descending order
  2. Ensures newest notifications appear first in the list
  3. Improves user experience by showing most recent notifications at
    the top
  4. Sorting happens before the model reset to maintain data consistency

fix: 在显示前按时间戳排序通知

  1. 添加了按创建时间(cTime)降序排列通知实体的功能
  2. 确保最新的通知显示在列表最前面
  3. 通过将最新通知显示在顶部来提升用户体验
  4. 排序操作在模型重置前完成以保持数据一致性

pms:BUG-299935

Summary by Sourcery

Bug Fixes:

  • Add sorting of notification entities by cTime in descending order to display the most recent notifications first

1. Added sorting of notification entities by creation time (cTime) in
descending order
2. Ensures newest notifications appear first in the list
3. Improves user experience by showing most recent notifications at
the top
4. Sorting happens before the model reset to maintain data consistency

fix: 在显示前按时间戳排序通知

1. 添加了按创建时间(cTime)降序排列通知实体的功能
2. 确保最新的通知显示在列表最前面
3. 通过将最新通知显示在顶部来提升用户体验
4. 排序操作在模型重置前完成以保持数据一致性

pms:BUG-299935
@sourcery-ai
Copy link

sourcery-ai bot commented Jul 8, 2025

Reviewer's Guide

Implements sorting of notification entities in descending order by creation time before model reset, ensuring newest notifications are displayed first.

Class diagram for NotifyStagingModel and NotifyEntity after sorting change

classDiagram
    class NotifyStagingModel {
        +void open()
        entities: std::vector<NotifyEntity>
    }
    class NotifyEntity {
        +qint64 cTime()
    }
    NotifyStagingModel "1" *-- "many" NotifyEntity: manages
Loading

File-Level Changes

Change Details Files
Add sorting of notifications by creation time in descending order
  • Inserted std::sort with lambda comparing cTime
  • Positioned sorting step immediately before beginResetModel to preserve data consistency
panels/notification/center/notifystagingmodel.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a 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!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • open函数中添加了对entities列表的排序操作,确保通知按照创建时间从新到旧排序。

是否建议立即修改:

  • 否,这个改动看起来是合理的,因为它提高了通知的显示顺序,使得最新的通知总是显示在最前面。但是,需要确保这个排序操作不会对性能产生负面影响,特别是在entities列表很大的情况下。

其他建议:

  • 如果entities列表非常大,考虑使用更高效的排序算法或者优化排序逻辑,以减少排序操作的时间复杂度。
  • 确保排序操作不会影响其他依赖于entities顺序的逻辑。
  • 添加注释说明为什么需要按照创建时间排序,以及这个排序对用户体验的影响。

@deepin-ci-robot
Copy link

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@18202781743 18202781743 merged commit 92f8ba3 into linuxdeepin:master Jul 8, 2025
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants