[PR #2055] [MERGED] feat(filters): add UI for marking saved filters as favorites #8022

Closed
opened 2026-04-20 17:59:27 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2055
Author: @kolaente
Created: 1/6/2026
Status: Merged
Merged: 1/7/2026
Merged by: @kolaente

Base: mainHead: feat-saved-filter-favorite


📝 Commits (7)

📊 Changes

7 files changed (+167 additions, -8 deletions)

View changed files

📝 frontend/src/components/home/Navigation.vue (+1 -1)
📝 frontend/src/components/home/ProjectsNavigationItem.vue (+14 -6)
📝 frontend/src/modelTypes/ISavedFilter.ts (+1 -0)
📝 frontend/src/models/savedFilter.ts (+1 -0)
📝 frontend/src/stores/projects.ts (+36 -1)
frontend/tests/e2e/project/saved-filter-favorite.spec.ts (+112 -0)
📝 pkg/models/saved_filters.go (+2 -0)

📄 Description

Summary

This PR adds UI support for marking saved filters as favorites. The backend already supports the is_favorite field, but the frontend didn't expose this functionality. Users can now favorite/unfavorite saved filters just like regular projects.

Changes

Frontend Type Definitions

  • Added isFavorite: boolean field to ISavedFilter interface
  • Added isFavorite = false property to SavedFilterModel class

UI Components

  • Modified ProjectsNavigationItem.vue to:
    • Show favorite button for saved filters (not just projects)
    • Added canToggleFavorite computed property to support both projects and saved filters
    • Added toggleFavorite method that routes to the appropriate store method

State Management

  • Added toggleSavedFilterFavorite method to project store that:
    • Fetches the full saved filter to get all required fields
    • Updates only the isFavorite field
    • Includes optimistic UI updates with error rollback

Testing

  • Added E2E test suite saved-filter-favorite.spec.ts with tests for:
    • Marking a saved filter as favorite
    • Removing a saved filter from favorites
    • Persistence of favorite status after page reload

Test Plan

  • Create a saved filter
  • Click the star icon to mark as favorite
  • Verify the filter appears in the Favorites section
  • Click the star again to unfavorite
  • Verify the filter moves out of the Favorites section
  • Refresh the page and verify favorite status persists
  • Run pnpm lint:fix - passes
  • Manual testing with Playwright - all scenarios working

Notes

  • No backend changes required - the API already supports this feature
  • The isFavorite field is automatically converted to is_favorite via AbstractService
  • Saved filters use negative IDs (formula: -1 * filter_id - 1) to appear as pseudo-projects

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/2055 **Author:** [@kolaente](https://github.com/kolaente) **Created:** 1/6/2026 **Status:** ✅ Merged **Merged:** 1/7/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `feat-saved-filter-favorite` --- ### 📝 Commits (7) - [`2e67bea`](https://github.com/go-vikunja/vikunja/commit/2e67beacbfa82aaaad24740a1ae2581168f6457e) feat(filters): add UI for marking saved filters as favorites - [`5bc359a`](https://github.com/go-vikunja/vikunja/commit/5bc359aca8e34183e5061e6faf1322aac699bf96) fix: restore filter - [`c9cad18`](https://github.com/go-vikunja/vikunja/commit/c9cad18fc19269c637fc77e2a8980914d9c6dee9) well - [`5175a85`](https://github.com/go-vikunja/vikunja/commit/5175a85763051dc60d8bb1fbb91da5a77b931206) more cleanup - [`d6543f3`](https://github.com/go-vikunja/vikunja/commit/d6543f3c30765420be909fd70cea6ff99486302e) fix: test assertion - [`d4177c0`](https://github.com/go-vikunja/vikunja/commit/d4177c03461cec1ed44ddd862cf5a999d7e6a0b0) cleanup - [`6eea84c`](https://github.com/go-vikunja/vikunja/commit/6eea84cb5fcf6ea944498b922b1a781d85e2f353) reorg ### 📊 Changes **7 files changed** (+167 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/components/home/Navigation.vue` (+1 -1) 📝 `frontend/src/components/home/ProjectsNavigationItem.vue` (+14 -6) 📝 `frontend/src/modelTypes/ISavedFilter.ts` (+1 -0) 📝 `frontend/src/models/savedFilter.ts` (+1 -0) 📝 `frontend/src/stores/projects.ts` (+36 -1) ➕ `frontend/tests/e2e/project/saved-filter-favorite.spec.ts` (+112 -0) 📝 `pkg/models/saved_filters.go` (+2 -0) </details> ### 📄 Description ## Summary This PR adds UI support for marking saved filters as favorites. The backend already supports the `is_favorite` field, but the frontend didn't expose this functionality. Users can now favorite/unfavorite saved filters just like regular projects. ## Changes ### Frontend Type Definitions - Added `isFavorite: boolean` field to `ISavedFilter` interface - Added `isFavorite = false` property to `SavedFilterModel` class ### UI Components - Modified `ProjectsNavigationItem.vue` to: - Show favorite button for saved filters (not just projects) - Added `canToggleFavorite` computed property to support both projects and saved filters - Added `toggleFavorite` method that routes to the appropriate store method ### State Management - Added `toggleSavedFilterFavorite` method to project store that: - Fetches the full saved filter to get all required fields - Updates only the `isFavorite` field - Includes optimistic UI updates with error rollback ### Testing - Added E2E test suite `saved-filter-favorite.spec.ts` with tests for: - Marking a saved filter as favorite - Removing a saved filter from favorites - Persistence of favorite status after page reload ## Test Plan - [x] Create a saved filter - [x] Click the star icon to mark as favorite - [x] Verify the filter appears in the Favorites section - [x] Click the star again to unfavorite - [x] Verify the filter moves out of the Favorites section - [x] Refresh the page and verify favorite status persists - [x] Run `pnpm lint:fix` - passes - [x] Manual testing with Playwright - all scenarios working ## Notes - No backend changes required - the API already supports this feature - The `isFavorite` field is automatically converted to `is_favorite` via `AbstractService` - Saved filters use negative IDs (formula: `-1 * filter_id - 1`) to appear as pseudo-projects --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 17:59:27 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#8022