This commit is contained in:
ponzischeme89
2026-08-19 06:57:59 +12:00
parent 8c847c59b8
commit 2b43b9ef12
94 changed files with 6359 additions and 778 deletions
+19 -4
View File
@@ -8,6 +8,7 @@ import (
"strings"
"time"
"github.com/ponzischeme89/memby/server/internal/notify"
"github.com/ponzischeme89/memby/server/internal/sonarr"
"github.com/ponzischeme89/memby/server/internal/store"
)
@@ -213,10 +214,18 @@ func (s *Server) syncReturnNotifications(
message = show.Title + " returns next week."
}
sourceKey := "show-return:" + show.ItemID + ":" + series.NextAiring.UTC().Format("2006-01-02")
_ = s.store.UpsertNotification(
r.Context(), sess.EmbyUserID, sourceKey, "show-return", show.ItemID,
"New episode coming", message, series.NextAiring,
)
s.notifyUser(r.Context(), notify.Notification{
Kind: "show-return",
Source: notifySourceShowReturn,
UserID: sess.EmbyUserID,
Username: sess.Username,
Title: "New episode coming",
Body: message,
ItemID: show.ItemID,
SourceKey: sourceKey,
EventAt: series.NextAiring,
Metadata: map[string]any{"show": show.Title, "leadDays": prefs.LeadDays},
})
}
}
@@ -231,6 +240,12 @@ func (s *Server) handleNotificationAction(
switch r.PathValue("action") {
case "read":
err = s.store.MarkNotificationRead(r.Context(), sess.EmbyUserID, id)
// Marking a notification back to new is the viewer's own action, where "read" is set by
// the page merely focusing a row. That is why the two are separate routes rather than one
// carrying a boolean: an automatic mark and a deliberate one are different events, and only
// this one is ever a decision somebody made with the remote.
case "unread":
err = s.store.MarkNotificationUnread(r.Context(), sess.EmbyUserID, id)
case "dismiss":
err = s.store.DismissNotification(r.Context(), sess.EmbyUserID, id)
default: