diff --git a/daemon/routes.go b/daemon/routes.go index 0c266f4a..0d070694 100644 --- a/daemon/routes.go +++ b/daemon/routes.go @@ -86,6 +86,8 @@ func routes(cfg *config.Config, store *storage.Storage, feedHandler *feed.Handle router.Handle("/subscribe", uiHandler.Use(uiController.SubmitSubscription)).Name("submitSubscription").Methods("POST") router.Handle("/subscriptions", uiHandler.Use(uiController.ChooseSubscription)).Name("chooseSubscription").Methods("POST") + router.Handle("/mark-all-as-read", uiHandler.Use(uiController.MarkAllAsRead)).Name("markAllAsRead").Methods("GET") + router.Handle("/unread", uiHandler.Use(uiController.ShowUnreadPage)).Name("unread").Methods("GET") router.Handle("/history", uiHandler.Use(uiController.ShowHistoryPage)).Name("history").Methods("GET") router.Handle("/starred", uiHandler.Use(uiController.ShowStarredPage)).Name("starred").Methods("GET") diff --git a/locale/translations.go b/locale/translations.go index ac073c8e..533238e9 100644 --- a/locale/translations.go +++ b/locale/translations.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// 2018-01-02 21:59:10.103098936 -0800 PST m=+0.030474265 +// 2018-01-04 18:06:27.675886358 -0800 PST m=+0.027242794 package locale @@ -211,12 +211,13 @@ var translations = map[string]string{ "Close modal dialog": "Fermer la boite de dialogue", "Save article": "Sauvegarder l'article", "There is already someone associated with this provider!": "Il y a déjà quelqu'un d'associé avec ce provider !", - "There is already someone else with the same Fever username!": "Il y a déjà quelqu'un d'autre avec le même nom d'utilisateur Fever !" + "There is already someone else with the same Fever username!": "Il y a déjà quelqu'un d'autre avec le même nom d'utilisateur Fever !", + "Mark all as read": "Tout marquer comme lu" } `, } var translationsChecksums = map[string]string{ "en_US": "6fe95384260941e8a5a3c695a655a932e0a8a6a572c1e45cb2b1ae8baa01b897", - "fr_FR": "3d8c0e211eb96ab28e2fd8fced718b6348a63ea824e54d0729a56e4e3f26ba64", + "fr_FR": "d68bc2178505410615aa2624b3efbf704f80c17a8024e2866d11c3abda587de7", } diff --git a/locale/translations/fr_FR.json b/locale/translations/fr_FR.json index 28ebe281..6bd4e4b1 100644 --- a/locale/translations/fr_FR.json +++ b/locale/translations/fr_FR.json @@ -195,5 +195,6 @@ "Close modal dialog": "Fermer la boite de dialogue", "Save article": "Sauvegarder l'article", "There is already someone associated with this provider!": "Il y a déjà quelqu'un d'associé avec ce provider !", - "There is already someone else with the same Fever username!": "Il y a déjà quelqu'un d'autre avec le même nom d'utilisateur Fever !" + "There is already someone else with the same Fever username!": "Il y a déjà quelqu'un d'autre avec le même nom d'utilisateur Fever !", + "Mark all as read": "Tout marquer comme lu" } diff --git a/storage/entry.go b/storage/entry.go index 3be6c92a..c6058d00 100644 --- a/storage/entry.go +++ b/storage/entry.go @@ -213,3 +213,16 @@ func (s *Storage) FlushHistory(userID int64) error { return nil } + +// MarkAllAsRead set all entries with the status "unread" to "read". +func (s *Storage) MarkAllAsRead(userID int64) error { + defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:MarkAllAsRead] userID=%d", userID)) + + query := `UPDATE entries SET status=$1 WHERE user_id=$2 AND status=$3` + _, err := s.db.Exec(query, model.EntryStatusRead, userID, model.EntryStatusUnread) + if err != nil { + return fmt.Errorf("unable to mark all entries as read: %v", err) + } + + return nil +} diff --git a/template/html/unread.html b/template/html/unread.html index feb5beb5..7f285d01 100644 --- a/template/html/unread.html +++ b/template/html/unread.html @@ -8,6 +8,9 @@