Skip to content

feat: add option to delete all finished tasks in a project (#2684) - #2756

Open
phenrique-coder wants to merge 3 commits into
alainm23:mainfrom
phenrique-coder:feat/delete-finished-tasks
Open

phenrique-coder wants to merge 3 commits into
alainm23:mainfrom
phenrique-coder:feat/delete-finished-tasks

Conversation

@phenrique-coder

@phenrique-coder phenrique-coder commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #2684.

Adds an option in the project dropdown context menu to delete all completed/finished tasks belonging to that project, including an Adw.AlertDialog confirmation dialog before deletion.

Changes

  • Store: Added delete_completed_items_by_project (Objects.Project project) in core/Services/Store.vala which calls item.delete_item () on each checked item in the project (properly propagating deletions to remote providers like Todoist and CalDAV/Deck as well as local database).
  • Project View: Added "Delete All Completed Tasks" menu item to build_context_menu_popover () in src/Views/Project/Project.vala:
    • Styled with menu-item-danger and user-trash-symbolic icon.
    • Dynamically updates sensitivity based on project.items_checked.size > 0 whenever the popover is opened.
    • Presents an Adw.AlertDialog confirmation dialog before deletion with a destructive "Delete" response button.
    • Reuses existing translated strings (_("Delete All Completed Tasks") and GLib.ngettext ("This will delete %d completed task and its subtasks from project %s", ...)).
    • Added // TRANSLATORS: comments to assist translators with gettext context.
  • UI Reactivity:
    • In src/Layouts/SectionBoard.vala, updated item_deleted signal handler to destroy and remove deleted items from checked_items_map and completed_items_list, ensuring completed tasks disappear immediately from board view.
    • In src/Layouts/SectionRow.vala, updated item_deleted signal handler to also clean up checked_items_map (matching by id_string) and completed_items_list.
  • Defensive: Ensured Objects.Project.source_type safely falls back to SourceType.LOCAL when source == null.
  • Tests: Added unit test suite in test/core/test-delete-completed-tasks.vala and registered it in test/test-core-runner.vala and test/meson.build, verifying that only completed tasks in the target project are deleted, active tasks are preserved, and tasks in other projects are untouched.

Testing

  • Ran full test suite (meson test -C build): 5/5 test suites passed (core, cli, caldav-integration, schema validation, desktop file validation).
  • Verified full build with ninja -C build.

@phenrique-coder
phenrique-coder marked this pull request as draft October 20, 2026 18:24
@phenrique-coder
phenrique-coder marked this pull request as ready for review October 20, 2026 18:44
@alainm23

Copy link
Copy Markdown
Owner

Works well, tested it with Todoist too and the deletion (with the spinner) is smooth.

One bit of feedback on placement: the "Delete All Completed Tasks" action feels a little hidden in the project's context menu. Could it instead show up right under the "Completed" toggle, appearing only when there are completed tasks? That spot feels more natural and discoverable. Everything else looks good to me.

var delete_completed_tasks_item = new Widgets.ContextMenu.MenuItem (_ ("Delete All Completed Tasks"), "user-trash-symbolic");
delete_completed_tasks_item.add_css_class ("menu-item-danger");

menu_box.append (new Widgets.ContextMenu.MenuSeparator ());

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thought on placement: could the "Delete All Completed Tasks" action live in the View Option Menu instead, and only be visible when the "Completed" toggle is on? That keeps it close to where completed tasks are shown and out of the way otherwise. Thanks!

This branch has not been deployed

No deployments
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.

Delete all finished tasks

2 participants