From 9fadcd216d86a4621367b0e762a3a493d03cb68a Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Tue, 9 Jun 2026 14:02:09 +0100 Subject: [PATCH] appview/{issues,pulls}: mark read-on-visit only outside focus mode notifications are marked as read when the underlying URL is visited. this now happens only when *outside* focus mode. when inside focus mode, the notif is only marked as read on hitting the `next` button on the focus pill. Signed-off-by: oppiliappan --- appview/issues/issues.go | 14 +++++++------- appview/pulls/single.go | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/appview/issues/issues.go b/appview/issues/issues.go index 67870d36..9ff1b60a 100644 --- a/appview/issues/issues.go +++ b/appview/issues/issues.go @@ -99,17 +99,17 @@ func (rp *Issues) RepoSingleIssue(w http.ResponseWriter, r *http.Request) { } if user != nil { - repoDid := f.RepoDid userDid := user.Did + repoDid := f.RepoDid issueId := issue.IssueId - go func() { - if err := db.MarkNotificationsReadForIssue(rp.db, userDid, repoDid, issueId); err != nil { - l.Error("failed to mark issue notifications as read", "err", err) - } - }() - atUri := issue.AtUri().String() + focusing := pages.BaseParamsFromContext(r.Context()).FocusParams.Focusing go func() { + if !focusing { + if err := db.MarkNotificationsReadForIssue(rp.db, userDid, repoDid, issueId); err != nil { + l.Error("failed to mark issue notifications as read", "err", err) + } + } if err := db.UpsertRecentLink(rp.db, userDid, models.RecentLinkTypeIssue, atUri); err != nil { l.Error("failed to upsert recent link", "err", err) } diff --git a/appview/pulls/single.go b/appview/pulls/single.go index 01229821..4d8ed3a4 100644 --- a/appview/pulls/single.go +++ b/appview/pulls/single.go @@ -102,17 +102,17 @@ func (s *Pulls) repoPullHelper(w http.ResponseWriter, r *http.Request, interdiff l = l.With("pull_id", pull.PullId, "pull_owner", pull.OwnerDid) if user != nil { - repoDid := f.RepoDid userDid := user.Did + repoDid := f.RepoDid pullId := pull.PullId - go func() { - if err := db.MarkNotificationsReadForPull(s.db, userDid, repoDid, pullId); err != nil { - l.Error("failed to mark pull notifications as read", "err", err) - } - }() - atUri := pull.AtUri().String() + focusing := pages.BaseParamsFromContext(r.Context()).FocusParams.Focusing go func() { + if !focusing { + if err := db.MarkNotificationsReadForPull(s.db, userDid, repoDid, pullId); err != nil { + l.Error("failed to mark pull notifications as read", "err", err) + } + } if err := db.UpsertRecentLink(s.db, userDid, models.RecentLinkTypePull, atUri); err != nil { l.Error("failed to upsert recent link", "err", err) } -- 2.51.2