Skip to content

fix: prevent duplicate power-off countdown notifications#1168

Open
52cyb wants to merge 1 commit into
linuxdeepin:masterfrom
52cyb:master
Open

fix: prevent duplicate power-off countdown notifications#1168
52cyb wants to merge 1 commit into
linuxdeepin:masterfrom
52cyb:master

Conversation

@52cyb

@52cyb 52cyb commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Add silent replacement hint to power-off countdown notifications to avoid stacking duplicate alerts when the system triggers multiple shutdown countdown sequences in quick succession.

Log: Fixed duplicate power-off countdown notifications by adding silent replacement hint

Influence:

  1. Trigger power-off countdown and verify no duplicate notification appears
  2. Test rapid consecutive shutdown commands and verify only one notification is shown
  3. Verify notification replacement works silently without visual stacking
  4. Test notification behavior across system resume from suspend/lock
  5. Verify other non-power-off notifications remain unaffected

fix: 防止电源关闭倒计时重复通知

在电源关闭倒计时通知中添加静默替换提示,避免系统在短时间内触发多次关闭倒
计时序列时出现重复通知堆积的问题。

Log: 修复电源关闭倒计时重复通知问题,添加静默替换提示

Influence:

  1. 触发电源关闭倒计时,验证不会显示重复通知
  2. 测试快速连续执行关机命令,验证只显示一条通知
  3. 验证通知静默替换功能正常工作,无视觉堆积
  4. 测试系统从挂起/锁定状态恢复后的通知行为
  5. 验证其他非电源关闭倒计时通知不受影响

PMS: BUG-367205

Summary by Sourcery

Bug Fixes:

  • Prevent duplicate power-off countdown notifications by enabling silent replacement of existing countdown alerts.

Add silent replacement hint to power-off countdown notifications to
avoid stacking duplicate alerts when the system triggers multiple
shutdown countdown sequences in quick succession.

Log: Fixed duplicate power-off countdown notifications by adding silent
replacement hint

Influence:
1. Trigger power-off countdown and verify no duplicate notification
appears
2. Test rapid consecutive shutdown commands and verify only one
notification is shown
3. Verify notification replacement works silently without visual
stacking
4. Test notification behavior across system resume from suspend/lock
5. Verify other non-power-off notifications remain unaffected

fix: 防止电源关闭倒计时重复通知

在电源关闭倒计时通知中添加静默替换提示,避免系统在短时间内触发多次关闭倒
计时序列时出现重复通知堆积的问题。

Log: 修复电源关闭倒计时重复通知问题,添加静默替换提示

Influence:
1. 触发电源关闭倒计时,验证不会显示重复通知
2. 测试快速连续执行关机命令,验证只显示一条通知
3. 验证通知静默替换功能正常工作,无视觉堆积
4. 测试系统从挂起/锁定状态恢复后的通知行为
5. 验证其他非电源关闭倒计时通知不受影响

PMS: BUG-367205
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 52cyb

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-ci-robot

Copy link
Copy Markdown

Hi @52cyb. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sourcery-ai

sourcery-ai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a silent replacement hint to power-off shutdown countdown notifications so that repeated shutdown sequences reuse a single notification instead of stacking duplicates.

Sequence diagram for power-off countdown silent notification replacement

sequenceDiagram
    actor User
    participant Manager
    participant NotificationServer

    User->>Manager: shutdownCountdownNotify
    Manager->>NotificationServer: [send poweroff countdown notification]
    Note over Manager,NotificationServer: hints include x-deepin-SilentReplace=true

    User->>Manager: shutdownCountdownNotify
    alt [existing notification present]
        Manager->>NotificationServer: [send notification with x-deepin-SilentReplace]
        NotificationServer-->>Manager: [existing notification silently replaced]
    else [no existing notification]
        Manager->>NotificationServer: [send new notification]
    end
Loading

File-Level Changes

Change Details Files
Ensure shutdown countdown notifications are silently replaced instead of stacking when multiple shutdown countdowns are triggered.
  • Extend the notification hints map used in shutdownCountdownNotify to include a silent replacement flag.
  • Set the x-deepin-SilentReplace hint to true so subsequent notifications reuse the existing one without visual stacking.
  • Keep all existing notification behavior (urgency, visibility in notify center, click behavior, and disappear-on-lock) unchanged.
session/power1/manager.go

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

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 defining "x-deepin-SilentReplace" as a shared constant (similar to any other notification hint keys you might have) to avoid typos and make future refactors easier.
  • It may be worth confirming whether SilentReplace is the desired behavior when playSound is true; if sound is part of the user feedback, you might want replacement without silencing or make the behavior explicit in the logic or comments.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider defining "x-deepin-SilentReplace" as a shared constant (similar to any other notification hint keys you might have) to avoid typos and make future refactors easier.
- It may be worth confirming whether `SilentReplace` is the desired behavior when `playSound` is true; if sound is part of the user feedback, you might want replacement without silencing or make the behavior explicit in the logic or comments.

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-bot

deepin-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.1.100
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1173

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants