Skip to content

Conversation

@wjyrich
Copy link
Contributor

@wjyrich wjyrich commented Jul 29, 2025

  1. Added check for drag source before processing dock request
  2. Prevents duplicate entries when dragging between taskbars
  3. Only processes dock request if source is not another taskbar
  4. Maintains clean taskbar state during drag operations

fix: 防止拖拽时任务栏出现重复条目

  1. 在处理停靠请求前添加了对拖动源的检查
  2. 防止在任务栏之间拖拽时出现重复条目
  3. 仅当来源不是其他任务栏时才处理停靠请求
  4. 在拖拽操作期间保持任务栏状态整洁

Summary by Sourcery

Bug Fixes:

  • Add drag source check to gate dock requests to non-taskbar origins and avoid duplicate entries when dragging between taskbars

@sourcery-ai
Copy link

sourcery-ai bot commented Jul 29, 2025

Reviewer's Guide

Prevents duplicate taskbar entries by adding a drag source check in TaskManager.qml so that dock requests are only processed for non-taskbar sources.

Sequence diagram for drag-and-drop handling between taskbars

sequenceDiagram
    participant User as actor User
    participant TaskbarA as Taskbar (Source)
    participant TaskbarB as Taskbar (Target)
    participant Applet

    User->>TaskbarA: Start drag of app item
    TaskbarA->>TaskbarB: Drag event with source info
    TaskbarB->>TaskbarB: Check drag source
    alt Source is not 'taskbar'
        TaskbarB->>Applet: requestDockByDesktopId(desktopId)
        Applet-->>TaskbarB: Returns success/failure
        alt Failure
            TaskbarB->>TaskbarB: resetDndState()
        end
    else Source is 'taskbar'
        TaskbarB->>TaskbarB: Ignore dock request
    end
Loading

Class diagram for TaskManager drag source check

classDiagram
    class TaskManager {
        launcherDndDragSource: string
        launcherDndDesktopId: string
        +onDragReceived(drag)
    }
    class Applet {
        +requestDockByDesktopId(desktopId: string): bool
    }
    TaskManager --> Applet: uses

    TaskManager : +onDragReceived(drag)
    TaskManager : checks launcherDndDragSource != "taskbar" before calling Applet.requestDockByDesktopId
Loading

File-Level Changes

Change Details Files
Added drag source validation before processing dock requests
  • Guard requestDockByDesktopId with launcherDndDragSource !== 'taskbar'
  • Retain resetDndState only when the dock request fails and the source is not a taskbar
panels/dock/taskmanager/package/TaskManager.qml

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 @wjyrich - I've reviewed your changes - here's some feedback:

  • Consider extracting the magic string 'taskbar' into a named constant to avoid hardcoded literals and improve maintainability.
  • Refactor the condition block to use an early return when launcherDndDragSource equals 'taskbar' for better readability.
  • Ensure launcherDndDragSource cannot be undefined or null before comparison to avoid potential edge-case errors.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider extracting the magic string 'taskbar' into a named constant to avoid hardcoded literals and improve maintainability.
- Refactor the condition block to use an early return when launcherDndDragSource equals 'taskbar' for better readability.
- Ensure launcherDndDragSource cannot be undefined or null before comparison to avoid potential edge-case errors.

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.

1. Added check for drag source before processing dock request
2. Prevents duplicate entries when dragging between taskbars
3. Only processes dock request if source is not another taskbar
4. Maintains clean taskbar state during drag operations

fix: 防止拖拽时任务栏出现重复条目

1. 在处理停靠请求前添加了对拖动源的检查
2. 防止在任务栏之间拖拽时出现重复条目
3. 仅当来源不是其他任务栏时才处理停靠请求
4. 在拖拽操作期间保持任务栏状态整洁
@wjyrich wjyrich force-pushed the fix-bug-315721-1 branch from 4690886 to d871070 Compare July 29, 2025 09:41
@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • 代码逻辑中增加了对 launcherDndDragSource 的检查,确保只有在 launcherDndDragSource 不等于 "taskbar" 时才调用 resetDndState()

是否建议立即修改:

  • 否,这次提交的修改看起来是合理的,没有发现明显的语法或逻辑错误。但是,建议进行进一步的测试以确保这个改动符合预期行为。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BLumia, wjyrich

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

@BLumia BLumia merged commit fb257ab into linuxdeepin:master Jul 29, 2025
7 of 10 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