fix(ui): prevent dragging completed tasks in the task list

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-10-01 11:44:17 +02:00
co-authored by Claude Sonnet 5.5
parent 2b7b58be37
commit b776fd28d8
3 changed files with 27 additions and 5 deletions
@@ -94,8 +94,8 @@ public partial class TasksIslandView : UserControl
&& parentVisual.FindAncestorOfType<Button>() is not null;
if (nestedInsideButton) return;
// Running tasks can be neither reordered nor re-queued.
if (row.IsRunning) return;
// Running and completed tasks can be neither reordered, moved nor re-queued.
if (row.IsRunning || row.Done) return;
// Arm the drag for ANY list kind so drag-to-queue works everywhere; reorder-on-drop is
// still gated on CanReorder (user lists only).
@@ -173,7 +173,7 @@ public partial class TasksIslandView : UserControl
{
var targetButton = RowButtonAt(e, topLevel);
if (targetButton?.DataContext is TaskRowViewModel target
&& !ReferenceEquals(target, row) && !target.IsRunning)
&& !ReferenceEquals(target, row) && !target.IsRunning && !target.Done)
{
var placeBelow = e.GetPosition(targetButton).Y > targetButton.Bounds.Height / 2;
await vm.ReorderAsync(row, target, placeBelow);
@@ -223,7 +223,7 @@ public partial class TasksIslandView : UserControl
var targetButton = RowButtonAt(e, topLevel);
if (targetButton?.DataContext is not TaskRowViewModel target
|| target.IsRunning || ReferenceEquals(target, _pressRow))
|| target.IsRunning || target.Done || ReferenceEquals(target, _pressRow))
{
vm.ClearDropHints();
return;
@@ -238,7 +238,7 @@ public partial class TasksIslandView : UserControl
if (placeBelow)
{
var next = FindNextInSameSection(vm, target);
if (next is not null && !next.IsRunning) { hintRow = next; hintBelow = false; }
if (next is not null && !next.IsRunning && !next.Done) { hintRow = next; hintBelow = false; }
else { hintRow = target; hintBelow = true; }
}