1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Add optional sort option in category page

closes #1552
This commit is contained in:
Romain de Laage 2022-10-16 07:36:59 +02:00 committed by Frédéric Guillot
parent ec47106c26
commit 83e1f154b5
26 changed files with 131 additions and 13 deletions

View file

@ -0,0 +1,13 @@
// Copyright 2017 Frédéric Guillot. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package model // import "miniflux.app/model"
// HomePages returns the list of available home pages.
func CategoriesSortOptions() map[string]string {
return map[string]string{
"unread_count": "form.prefs.select.unread_count",
"alphabetical": "form.prefs.select.alphabetical",
}
}

View file

@ -33,6 +33,7 @@ type User struct {
DefaultReadingSpeed int `json:"default_reading_speed"`
CJKReadingSpeed int `json:"cjk_reading_speed"`
DefaultHomePage string `json:"default_home_page"`
CategoriesSortOrder string `json:"categories_sort_order"`
}
// UserCreationRequest represents the request to create a user.
@ -65,6 +66,7 @@ type UserModificationRequest struct {
DefaultReadingSpeed *int `json:"default_reading_speed"`
CJKReadingSpeed *int `json:"cjk_reading_speed"`
DefaultHomePage *string `json:"default_home_page"`
CategoriesSortOrder *string `json:"categories_sort_order"`
}
// Patch updates the User object with the modification request.
@ -144,6 +146,10 @@ func (u *UserModificationRequest) Patch(user *User) {
if u.DefaultHomePage != nil {
user.DefaultHomePage = *u.DefaultHomePage
}
if u.CategoriesSortOrder != nil {
user.CategoriesSortOrder = *u.CategoriesSortOrder
}
}
// UseTimezone converts last login date to the given timezone.