From 3a47c062da67b901e17ab7c3b8620de42be67ab1 Mon Sep 17 00:00:00 2001 From: Samuel Rodda <7961255+IAMSamuelRodda@users.noreply.github.com> Date: Wed, 7 Jan 2026 01:47:17 +1030 Subject: [PATCH] fix(filters): preserve IsFavorite for saved filters in ReadOne (#2031) - Saved filters' `IsFavorite` field was not being properly returned when fetched as pseudo-projects via `/projects/{id}` - This caused favorited filters to appear in both the Favorites and Filters sections initially, but then disappear from Favorites after clicking on them (navigating to the filter) Fixes #1989 Co-authored-by: iamsamuelrodda --- pkg/models/project.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/models/project.go b/pkg/models/project.go index 5267977b4..adf77c740 100644 --- a/pkg/models/project.go +++ b/pkg/models/project.go @@ -295,6 +295,7 @@ func (p *Project) ReadOne(s *xorm.Session, a web.Auth) (err error) { } p.Title = sf.Title p.Description = sf.Description + p.IsFavorite = sf.IsFavorite p.Created = sf.Created p.Updated = sf.Updated p.OwnerID = sf.OwnerID @@ -334,9 +335,13 @@ func (p *Project) ReadOne(s *xorm.Session, a web.Auth) (err error) { } } - p.IsFavorite, err = isFavorite(s, p.ID, a, FavoriteKindProject) - if err != nil { - return + // For saved filters, IsFavorite was already set from the SavedFilter struct. + // Don't overwrite it with the project favorites lookup. + if !isFilter { + p.IsFavorite, err = isFavorite(s, p.ID, a, FavoriteKindProject) + if err != nil { + return + } } subs, err := GetSubscriptionForUser(s, SubscriptionEntityProject, p.ID, a)