Skip to content

fix(notification): adjust notification sound playback timing#1532

Merged
deepin-bot[bot] merged 2 commits intolinuxdeepin:masterfrom
add-uos:fix/BUG-354203
Mar 25, 2026
Merged

fix(notification): adjust notification sound playback timing#1532
deepin-bot[bot] merged 2 commits intolinuxdeepin:masterfrom
add-uos:fix/BUG-354203

Conversation

@add-uos
Copy link
Contributor

@add-uos add-uos commented Mar 25, 2026

Move the sound playback to the end of Notify function, after all
notification display logic has been processed. This ensures sound is
played at the appropriate time in the notification flow.

将音效播放移到Notify函数末尾,在所有通知显示逻辑处理完成后。
这确保音效在通知流程的适当时机播放。

Log: 调整通知音效播放时机
PMS: BUG-354203
Influence: 调整音效播放时机到通知处理流程的最后阶段,
确保音效播放的时机更加合理。

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 25, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts notification replacement handling so that missing replacesId no longer causes failure, instead logging and treating it as a new notification, in line with the freedesktop spec.

Sequence diagram for handling notifications with missing replacesId

sequenceDiagram
    actor App
    participant NotificationManager
    participant Persistence

    App->>NotificationManager: sendNotification(summary, body, replacesId)
    alt has replacesId
        NotificationManager->>Persistence: findEntityById(replacesId)
        alt entity exists
            Persistence-->>NotificationManager: lastEntity
            NotificationManager->>Persistence: replaceEntity(lastEntity.id, newEntity)
            Persistence-->>NotificationManager: newId
            NotificationManager-->>App: success(newId)
        else entity does not exist
            Note over NotificationManager: Log: Not exist notification to replace
            NotificationManager->>Persistence: saveEntityAsNew(newEntity)
            Persistence-->>NotificationManager: newId
            NotificationManager-->>App: success(newId)
        end
    else no replacesId
        NotificationManager->>Persistence: saveEntityAsNew(newEntity)
        Persistence-->>NotificationManager: newId
        NotificationManager-->>App: success(newId)
    end
Loading

File-Level Changes

Change Details Files
Handle non-existent replacesId by logging and proceeding as a new notification instead of failing.
  • Removed early return false when a notification to replace cannot be found for the given replacesId.
  • Added explanatory comments describing why a missing notification to replace can occur and that it is now treated as a new notification.
  • Changed qWarning call to include the notifyLog category and extended log details with the bubbleId while no longer aborting the notification recording flow.
panels/notification/server/notificationmanager.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 - I've left some high level feedback:

  • Consider updating the recordNotification contract (e.g., method comment or callers’ assumptions) now that an invalid replacesId no longer causes a false return, to avoid confusing semantics around when this function can fail.
  • Since the situation is now treated as a normal flow rather than an error, you might want to downgrade the log level from qWarning to something less severe (e.g., info/debug) to reduce noise in logs.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider updating the `recordNotification` contract (e.g., method comment or callers’ assumptions) now that an invalid `replacesId` no longer causes a `false` return, to avoid confusing semantics around when this function can fail.
- Since the situation is now treated as a normal flow rather than an error, you might want to downgrade the log level from `qWarning` to something less severe (e.g., info/debug) to reduce noise in logs.

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.

@add-uos add-uos closed this Mar 25, 2026
@add-uos add-uos reopened this Mar 25, 2026
Move the sound playback to the end of Notify function, after all
notification display logic has been processed. This ensures sound is
played at the appropriate time in the notification flow.

将音效播放移到Notify函数末尾,在所有通知显示逻辑处理完成后。
这确保音效在通知流程的适当时机播放。

Log: 调整通知音效播放时机
PMS: BUG-354203
Influence: 调整音效播放时机到通知处理流程的最后阶段,
确保音效播放的时机更加合理。
@add-uos add-uos changed the title fix(notification): handle invalid replacesId gracefully fix(notification): adjust notification sound playback timing Mar 25, 2026
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, add-uos

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

@deepin-bot
Copy link

deepin-bot bot commented Mar 25, 2026

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit 4da54fb into linuxdeepin:master Mar 25, 2026
9 of 12 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