fix: store registry page timestamps in UTC
- GORM stamped created_at and updated_at in the process's local time, which the timestamp columns keep as the wall clock; east of UTC a page without a content date got a sitemap lastmod in the future - Page.BeforeSave stamps both in UTC for the admin's and the API's saves, and the admin's address change writes updated_at in UTC
This commit is contained in:
@@ -3,6 +3,7 @@ package seo
|
||||
import (
|
||||
"context"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"git.golem15.com/golem15/sm-seo-plugin/classes"
|
||||
"git.golem15.com/golem15/sm-seo-plugin/controllers"
|
||||
@@ -105,7 +106,7 @@ func (p *Plugin) pagesForm() *pact.AdminFormExtension {
|
||||
return pact.AdminFormSaveResult{}, refusals
|
||||
}
|
||||
if err := in.DB.Model(&models.Page{}).Where("id = ?", page.ID).Updates(map[string]any{
|
||||
"url": page.URL, "urls": page.URLs, "title": page.Title, "titles": page.Titles,
|
||||
"url": page.URL, "urls": page.URLs, "title": page.Title, "titles": page.Titles, "updated_at": time.Now().UTC(),
|
||||
}).Error; err != nil {
|
||||
return pact.AdminFormSaveResult{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user