···
···
func (h *Handler) HandleNotificationFeed(w http.ResponseWriter, r *http.Request) {
user, err := bsky.GetUserWithBskyProfile(h.Oauth, r)
-
log.Println("failed to get logged-in user:", err)
htmx.HxRedirect(w, "/login")
···
page, err := strconv.ParseInt(pageStr, 10, 64)
-
log.Println("failed to parse page value:", err)
···
notifications, err := db.GetNotificationsByDid(h.Db, user.Did, pageSize+1, int(offset))
-
log.Println("failed to retrieve notifications:", err)
htmx.HxError(w, http.StatusInternalServerError, "Failed to get notifications, try again later.")
hydratedNotifications, err := h.getBskyProfileHydratedNotificationFeed(notifications)
-
log.Println("failed to hydrate notifications with bsky profile:", err)
htmx.HxError(w, http.StatusInternalServerError, "Failed to get notifications, try again later.")
···
func (h *Handler) HandleNotificationMarkAllRead(w http.ResponseWriter, r *http.Request) {
user, err := bsky.GetUserWithBskyProfile(h.Oauth, r)
-
log.Println("failed to get logged-in user:", err)
htmx.HxRedirect(w, "/login")
err = db.MarkAllNotificationsAsRead(h.Db, user.Did)
-
log.Println("failed to mark all notifications:", err)
htmx.HxError(w, http.StatusInternalServerError, "Failed to mark all notifications as read, try again later.")
···
···
func (h *Handler) HandleNotificationFeed(w http.ResponseWriter, r *http.Request) {
+
l := h.Logger.With("handler", "HandleNotificationFeed")
user, err := bsky.GetUserWithBskyProfile(h.Oauth, r)
+
l.Error("failed to get logged-in user", "err", err)
htmx.HxRedirect(w, "/login")
···
page, err := strconv.ParseInt(pageStr, 10, 64)
+
l.Error("failed to parse page value", "err", err)
···
notifications, err := db.GetNotificationsByDid(h.Db, user.Did, pageSize+1, int(offset))
+
l.Error("failed to retrieve notifications", "err", err)
htmx.HxError(w, http.StatusInternalServerError, "Failed to get notifications, try again later.")
hydratedNotifications, err := h.getBskyProfileHydratedNotificationFeed(notifications)
+
l.Error("failed to hydrate notifications with bsky profile", "err", err)
htmx.HxError(w, http.StatusInternalServerError, "Failed to get notifications, try again later.")
···
func (h *Handler) HandleNotificationMarkAllRead(w http.ResponseWriter, r *http.Request) {
+
l := h.Logger.With("handler", "HandleNotificationMarkAllRead")
user, err := bsky.GetUserWithBskyProfile(h.Oauth, r)
+
l.Error("failed to get logged-in user", "err", err)
htmx.HxRedirect(w, "/login")
err = db.MarkAllNotificationsAsRead(h.Db, user.Did)
+
l.Error("failed to mark all notifications", "err", err)
htmx.HxError(w, http.StatusInternalServerError, "Failed to mark all notifications as read, try again later.")