mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Entries date should contains user timezone (API)
This commit is contained in:
parent
f110384f11
commit
0c7039de0e
5 changed files with 146 additions and 17 deletions
|
@ -13,6 +13,7 @@ import (
|
|||
|
||||
"github.com/miniflux/miniflux/model"
|
||||
"github.com/miniflux/miniflux/timer"
|
||||
"github.com/miniflux/miniflux/timezone"
|
||||
)
|
||||
|
||||
// EntryQueryBuilder builds a SQL query to fetch entries.
|
||||
|
@ -160,7 +161,8 @@ func (e *EntryQueryBuilder) GetEntries() (model.Entries, error) {
|
|||
e.url, e.author, e.content, e.status, e.starred,
|
||||
f.title as feed_title, f.feed_url, f.site_url, f.checked_at,
|
||||
f.category_id, c.title as category_title, f.scraper_rules, f.rewrite_rules, f.crawler,
|
||||
fi.icon_id
|
||||
fi.icon_id,
|
||||
u.timezone
|
||||
FROM entries e
|
||||
LEFT JOIN feeds f ON f.id=e.feed_id
|
||||
LEFT JOIN categories c ON c.id=f.category_id
|
||||
|
@ -183,6 +185,7 @@ func (e *EntryQueryBuilder) GetEntries() (model.Entries, error) {
|
|||
for rows.Next() {
|
||||
var entry model.Entry
|
||||
var iconID interface{}
|
||||
var tz string
|
||||
|
||||
entry.Feed = &model.Feed{UserID: e.userID}
|
||||
entry.Feed.Category = &model.Category{UserID: e.userID}
|
||||
|
@ -210,6 +213,7 @@ func (e *EntryQueryBuilder) GetEntries() (model.Entries, error) {
|
|||
&entry.Feed.RewriteRules,
|
||||
&entry.Feed.Crawler,
|
||||
&iconID,
|
||||
&tz,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
@ -222,6 +226,10 @@ func (e *EntryQueryBuilder) GetEntries() (model.Entries, error) {
|
|||
entry.Feed.Icon.IconID = iconID.(int64)
|
||||
}
|
||||
|
||||
// Make sure that timestamp fields contains timezone information (API)
|
||||
entry.Date = timezone.Convert(tz, entry.Date)
|
||||
entry.Feed.CheckedAt = timezone.Convert(tz, entry.Feed.CheckedAt)
|
||||
|
||||
entry.Feed.ID = entry.FeedID
|
||||
entry.Feed.Icon.FeedID = entry.FeedID
|
||||
entries = append(entries, &entry)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue