-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix push mirror, wrong timestamp format #27153
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change. Please add a note into the PR description.
I added the template for you.
As this is a small fix, could this be merged into the 1.21.0 milestone? |
CreatedUnix: pm.CreatedUnix.FormatLong(), | ||
LastUpdateUnix: pm.LastUpdateUnix.FormatLong(), | ||
CreatedUnix: pm.CreatedUnix.AsTime(), | ||
LastUpdateUnix: pm.LastUpdateUnix.AsTimePtr(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But pm.LastUpdateUnix
maybe nil.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pm.LastUpdateUnix
is a timeutil.TimeStamp
not *timeutil.TimeStamp
. It can only be pm.LastUpdateUnix.IsZero()
if I'm not mistaken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was also a bit confused about that. So I guess I change it back to not be a pointer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so maybe we should change
// AsTimePtrInLocation convert timestamp as *time.Time in customize location
func (ts TimeStamp) AsTimePtrInLocation(loc *time.Location) *time.Time {
tm := time.Unix(int64(ts), 0).In(loc)
return &tm
}
to
// AsTimePtrInLocation convert timestamp as *time.Time in customize location
func (ts TimeStamp) AsTimePtrInLocation(loc *time.Location) *time.Time {
if ts.IsZero() {
return nil
}
tm := time.Unix(int64(ts), 0).In(loc)
return &tm
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I guess this is resolved and the proposed change should be done in a different PR?
Do we backport breaking changes? I don't see this PR as a bug fix. |
Agree, it's probably better not to backport, sorry @kilimnik. |
* giteaofficial/main: Add missing public user visibility in user details page (go-gitea#27246) Use mask-based fade-out effect for `.new-menu` (go-gitea#27181) [skip ci] Updated translations via Crowdin Fix z-index on markdown completion (go-gitea#27237) Update database-preparation and add note re: MariaDB (go-gitea#27232) cleanup locale function usage (go-gitea#27227) Fix EOL handling in web editor (go-gitea#27141) Fix PushEvent NullPointerException jenkinsci/github-plugin (go-gitea#27203) fix issues on action runners page (go-gitea#27226) Fix Fomantic UI dropdown icon bug when there is a search input in menu (go-gitea#27225) Update go-enry to 2.8.5 (go-gitea#27215) Update nodejs installation method in release container (go-gitea#27207) Quote table `release` in sql queries (go-gitea#27205) Fix push mirror, wrong timestamp format (go-gitea#27153) Allow copying issue comment link on archived repos and when not logged in (go-gitea#27193) fix: text decorator on issue sidebar menu label (go-gitea#27206) Update JS and Poetry dependencies and eslint (go-gitea#27200) Remove some dead code (go-gitea#27196) # Conflicts: # templates/repo/issue/view_content/context_menu.tmpl
I noticed, that the push mirrors endpoint, is the only endpoint which returns the times in long format rather than as time.Time().
I think the behavior should be consistent across the project.
This PR changes the time format used in API responses for all push_mirror endpoints which return a push mirror.