0.2.77
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user