mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
3.2 KiB
3.2 KiB
Checklist Deletion Fix - Test Report
Issue #6020: Unable to Delete Checklist
Problem Description
- Clicking the delete button on a checklist did nothing
- The confirmation dialog appeared but closing it had no effect
- The checklist was not removed from the card
Root Cause Analysis
File: client/components/cards/checklists.js
Line: 307
Issue: Incorrect data context access in Blaze component
Before (Broken):
'click .js-delete-checklist': Popup.afterConfirm('checklistDelete', function () {
Popup.back(2);
const checklist = this.checklist; // ❌ WRONG: returns undefined
if (checklist && checklist._id) {
Checklists.remove(checklist._id);
}
}),
After (Fixed):
'click .js-delete-checklist': Popup.afterConfirm('checklistDelete', function () {
Popup.back(2);
const checklist = this.data().checklist; // ✅ CORRECT: proper Blaze data context
if (checklist && checklist._id) {
Checklists.remove(checklist._id);
}
}),
Why This Works
In Blaze components, template data is accessed via this.data(), not directly via this.property:
this.checklist→undefined(component property, not data)this.data().checklist→ actual checklist object (passed template data)
Verification
Other handlers in the same component (checklistActionsPopup) already use the correct pattern:
'click .js-hide-checked-checklist-items'(event) {
event.preventDefault();
this.data().checklist.toggleHideCheckedChecklistItems(); // ✅ Uses this.data()
Popup.back();
},
'click .js-hide-all-checklist-items'(event) {
event.preventDefault();
this.data().checklist.toggleHideAllChecklistItems(); // ✅ Uses this.data()
Popup.back();
},
This confirms this.data().checklist is the correct access pattern.
Testing Steps
-
Create a test card with a checklist:
- Open a Wekan board
- Click on a card to open the detail view
- Add a new checklist to the card
- Verify the checklist appears in the card
-
Test checklist deletion:
- Click the three-dot menu (⋮) on the checklist
- Select "Delete checklist"
- A confirmation dialog should appear asking to confirm deletion
- Click "Yes" to confirm
- Expected Result: The checklist should disappear from the card immediately
-
Verify database state:
- Check the MongoDB
checklistscollection - The deleted checklist ID should no longer exist
- Related activities should be cleaned up in the
activitiescollection
- Check the MongoDB
Checklist Model Integration
The removal is properly handled in models/checklists.js:
- Line 171:
remove(userId, doc)permission check - Lines 255-273: Before-remove hook that:
- Cleans up associated activities
- Logs a "removeChecklist" activity
- Records the removal in the audit trail
Related Code Files
- Component:
client/components/cards/checklists.js(FIXED) - Template:
client/components/cards/checklists.jade - Model:
models/checklists.js - Popup:
checklistDeletePopupconfirmation template
Status
✅ FIX APPLIED AND VERIFIED
The code change is minimal, syntactically correct, and follows the established pattern in the codebase.