Add 'mark all read' option to notifications (#3097)
* Add 'mark all read' option to notifications Signed-off-by: Sasha Varlamov <sasha@sashavarlamov.com> * Fix exported comment Signed-off-by: Sasha Varlamov <sasha@sashavarlamov.com> * Format method comments Signed-off-by: Sasha Varlamov <sasha@sashavarlamov.com> * Fix exported comment Signed-off-by: Sasha Varlamov <sasha@sashavarlamov.com> Format method comments Signed-off-by: Sasha Varlamov <sasha@sashavarlamov.com> Tests for reactions (#3083) * Unit tests for reactions * Fix import order Signed-off-by: Lauris Bukšis-Haberkorns <lauris@nix.lv> Fix reaction possition when there is attachments (#3099) Refactor notifications swap function * Accept change to drop beforeupdate call * Update purge notifications error message for consistency * Drop unnecessary check for mark all as read button * Remove debugging comment
This commit is contained in:
parent
1ed7f18815
commit
7ec6cddd27
7 changed files with 78 additions and 4 deletions
|
@ -706,6 +706,7 @@ func RegisterRoutes(m *macaron.Macaron) {
|
|||
m.Group("/notifications", func() {
|
||||
m.Get("", user.Notifications)
|
||||
m.Post("/status", user.NotificationStatusPost)
|
||||
m.Post("/purge", user.NotificationPurgePost)
|
||||
}, reqSignIn)
|
||||
|
||||
m.Group("/api", func() {
|
||||
|
|
|
@ -112,3 +112,15 @@ func NotificationStatusPost(c *context.Context) {
|
|||
url := fmt.Sprintf("%s/notifications", setting.AppSubURL)
|
||||
c.Redirect(url, 303)
|
||||
}
|
||||
|
||||
// NotificationPurgePost is a route for 'purging' the list of notifications - marking all unread as read
|
||||
func NotificationPurgePost(c *context.Context) {
|
||||
err := models.UpdateNotificationStatuses(c.User, models.NotificationStatusUnread, models.NotificationStatusRead)
|
||||
if err != nil {
|
||||
c.Handle(500, "ErrUpdateNotificationStatuses", err)
|
||||
return
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("%s/notifications", setting.AppSubURL)
|
||||
c.Redirect(url, 303)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue